Hmm! Let's try.
With the piston at B.D.C. (bottom dead centre), at the start of the compression stroke; the cylinder and combustion chamber will be filled with an optimum amount of fuel/air mixture. As the piston rises to T.D.C. (top dead centre), that fuel/air mixture will be compressed to an extent determined by the stroke/bore ratio of that particular engine and the capacity of the combustion chamber. Yes, using a thicker cylinder head gasket (if available) will reduce the compression ratio; and using a different suitable piston (if available) will raise that compression ratio.
Comments: The length of the stroke is controlled by the combined design of the cranckshaft and connecting rod. The bore size is the diameter of the piston.
Is that enough? I always stand to be corrected.
Sylvain.