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
This is what I'm expecting:
what could be the problem?
Unpredicted behaviour when using extent (SOLVED)
Unpredicted behaviour when using extent (SOLVED)
Last edited by ddayan on 2011-04-30T03:48:51-07:00, edited 1 time in total.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Unpredicted behaviour when using extent
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.
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/
https://imagemagick.org/Usage/
Re: Unpredicted behaviour when using extent
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.