Unpredicted behaviour when using extent (SOLVED)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ddayan
Posts: 6
Joined: 2011-02-18T20:00:39-07:00
Authentication code: 8675308

Unpredicted behaviour when using extent (SOLVED)

Post 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?
Last edited by ddayan on 2011-04-30T03:48:51-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Unpredicted behaviour when using extent

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ddayan
Posts: 6
Joined: 2011-02-18T20:00:39-07:00
Authentication code: 8675308

Re: Unpredicted behaviour when using extent

Post 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.
Post Reply