So how should custom spoilers be formatted?

Normal preview images are 255x255px but a spoiler that size apparently gets compressed to something like 255x172px distorting the image.

I managed to create an undistorted spoiler by embedding it in a transparent 255x172 image but then the resulting visible preview is only 172px high instead of 255 like normal images.

Any way to fix this?