I can't get this to work, so wondering if it is possible.
I have some thumbnails of variable size that I need to fit into a 220 x 220 square. My intention is to display the image at its original size (e.g. 100 x 140), with padding surrounding it and a background colour applied.
If I use the settings below, the image is padded to the left and right but stretched beyond its original size
There's no way to do what you want with ImageGen unfortunately. Padding means you resize to a maximum dimension (220px in your example) while maintaining a proportional resizing of the original image; then any space left over is padded with the background color to make up the full size you requested. By not allowing upsizing you won't get an image bigger than the original even if you request a bigger dimension. So ImageGen is behaving properly, though not in the way you were hoping it might.
Personally, in this case I would use CSS to align and pad the background rather than creating a larger image to download to the website visitor by including the padding in the resized image itself. If the original image needs to be resized (or cropped) I'd use ImageGen for that part, but leave the background padding to CSS.
Padding an image without upsizing it?
I can't get this to work, so wondering if it is possible.
I have some thumbnails of variable size that I need to fit into a 220 x 220 square. My intention is to display the image at its original size (e.g. 100 x 140), with padding surrounding it and a background colour applied.
If I use the settings below, the image is padded to the left and right but stretched beyond its original size
<Width>220</Width>
<Height>220</Height>
<Pad>true</Pad>
<BgColor>FBFBFA</BgColor>
If I add <AllowUpsizing>false</AllowUpsizing>, then the image is displayed at its original size but with no padding.
Is there anyway to apply padding all the way round an image, and prevent it being upsized?
HI, Ollie,
There's no way to do what you want with ImageGen unfortunately. Padding means you resize to a maximum dimension (220px in your example) while maintaining a proportional resizing of the original image; then any space left over is padded with the background color to make up the full size you requested. By not allowing upsizing you won't get an image bigger than the original even if you request a bigger dimension. So ImageGen is behaving properly, though not in the way you were hoping it might.
Personally, in this case I would use CSS to align and pad the background rather than creating a larger image to download to the website visitor by including the padding in the resized image itself. If the original image needs to be resized (or cropped) I'd use ImageGen for that part, but leave the background padding to CSS.
cheers,
doug.
is working on a reply...