Page 1 of 1

Unpredicted behaviour when using extent (SOLVED)

Posted: 2011-04-30T01:35:25-07:00
by ddayan
I'm using the rmagick extend function

cropped_image.background_color= "#ffffff"
cropped_image = cropped_image.extent(256, 256)

But in some cases it doesn't extend the image with white background
Image

This is what I'm expecting:
Image


what could be the problem?

Re: Unpredicted behaviour when using extent

Posted: 2011-04-30T03:13:14-07:00
by anthony
That is weird. there is no code in Extent to actually resize images as shown!
It is really a 'create canvas', and compose image (with gravity) onto canvas operator.

When it was first developed it was actually as a ultra fast image size resize without data modification (may produce garbage) but peoples demand for it it as a way f padding images to a input size, caused it to be re-programed into a canvas compose operator instead. I can even remember the forum discussion about it, but that discussion was lost in a disk crash a long time ago.

Re: Unpredicted behaviour when using extent

Posted: 2011-04-30T03:48:08-07:00
by ddayan
Thanks! It made be to realise that the problem is in my code. I found a case that the image stretches to the tile size before the extent function is being used.
anthony wrote:That is weird. there is no code in Extent to actually resize images as shown!
It is really a 'create canvas', and compose image (with gravity) onto canvas operator.

When it was first developed it was actually as a ultra fast image size resize without data modification (may produce garbage) but peoples demand for it it as a way f padding images to a input size, caused it to be re-programed into a canvas compose operator instead. I can even remember the forum discussion about it, but that discussion was lost in a disk crash a long time ago.