Page 2 of 2

Re: unexpected result of image flattening - doubling the width..

Posted: 2009-05-22T20:52:23-07:00
by fmw42
This works for me on my Godaddy server account

<?php
$IM_list=shell_exec("/usr/local/bin/convert -list");
echo $IM_list
?>

as do these


<?php
system("/usr/local/bin/convert -list");
?>

<?php
exec("/usr/local/bin/convert -list",$out,$returnval);
print_r($out);
?>

Re: unexpected result of image flattening - doubling the width..

Posted: 2009-05-22T21:51:54-07:00
by tobycarr
Thanks - handy options.
As I said all other lists were working fine with my old verbose info method - it was only when there was no extra option between -list and -verbose that it didn't like it..
but I am sure the options you have offered are cleaner and more flexible for ALL ..ta

Re: unexpected result of image flattening - doubling the width..

Posted: 2009-05-25T22:12:40-07:00
by anthony
tobycarr wrote:Great! Thank you very much - works nicely. SO does that mean a png file created with IM carries some IM-based info like virtual canvas dimensions, or is that standard for pngs? Excuse my ignorance..
IM usually does not add IM specific information to an image. But in the case of PNG, it does.

PNG images by default can include a page offset. Im only adds the canvas size. when reading a PNG that does nto have a canvas size, it will try and figure out an appropriate canvas size so the image remain visible.

See IM Examples Common File Formats, PNG and the virtual canvas
http://www.imagemagick.org/Usage/formats/#png_offsets

You however reset any offset that was present in the image using -page before reading the image. But you can also reset it using -repage as well after reading.
for example...

Code: Select all

   convert   \( bg_image.png +repage \)  \( overlay.png -repage 0x0+25+25 \) ....
better still you should have used +repage before saving it originally!!!!! That is always a good idea when you don't want to preseve that information from the original -crop


Another alturnative is to have used -layers merge +repage instead of -flatten This ignores any existing canvas size information and generates the smallest image that contains all the image layers. However you again may have to remove that images offset and canvas information to finish up.

See Layers Merge
http://www.imagemagick.org/Usage/layers/#merge


Also using -composite instead would have ignored all layer information present (different technique and style of image handling) You would set an 0ffset using -geometry. However while it ignores all layer offsets and sizes, it does NOT clear that information if present either.

Re: unexpected result of image flattening - doubling the width..

Posted: 2009-05-25T23:58:52-07:00
by tobycarr
Very comprehensive and educational - thanks Anthony - will refine technique accordingly.