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.