How to see virtual canvas info in png metadata

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
tobycarr

How to see virtual canvas info in png metadata

Post by tobycarr »

Hi,
Is there a way to see what the virtual canvas settings are for a png image using say, identify?
I can see the line in the identify output that says size e.g. Geometry: 1000x1000+0+0
Is this it? the +0+0 being the virtual canvas??
Doesn't seem to correlate with images that appear to have virtual canvases ( based on their reactions to certain commands and their adjusted reactions after repaging) having geometry settings of nxn+0+0.
Thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to see virtual canvas info in png metadata

Post by fmw42 »

see page geometry in identify -verbose


identify -verbose bg_image.png
Image: bg_image.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 240x270+0+0
Resolution: 150x150
Print size: 1.6x1.8
Units: PixelsPerCentimeter
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: RGB
Depth: 8/1-bit
Channel depth:
gray: 1-bit
alpha: 1-bit
Channel statistics:
gray:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
alpha:
min: 0 (0)
max: 255 (1)
mean: 8.7125 (0.0341667)
standard deviation: 46.3226 (0.181657)
kurtosis: 24.3037
skewness: -5.12871
Alpha: none #00000000
Histogram:
62586: ( 0, 0, 0, 0) #00000000 none
2214: ( 0, 0, 0,255) #000000 black
Rendering intent: Undefined
Chromaticity:
red primary: (0.63999,0.33001)
green primary: (0.3,0.6)
blue primary: (0.15,0.05999)
white point: (0.31269,0.32899)
Interlace: None
Background color: black
Border color: rgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Page geometry: 480x270+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
create-date: 2009-05-24T20:54:08-07:00
modify-date: 2009-05-24T20:54:08-07:00
signature: 4c3538022e909adf8ca768298b29a31cc398b3d1e0710b115ae623309bb7b86f
Profiles:
Profile-icc: 3144 bytes
IEC 61966-2.1 Default RGB colour space - sRGB
Artifacts:
verbose: true
Tainted: False
Filesize: 3.41kb
Number pixels: 63.3kb
Version: ImageMagick 6.5.2-8 2009-05-24 Q16 http://www.imagemagick.org
tobycarr

Re: How to see virtual canvas info in png metadata

Post by tobycarr »

Thanks Fred,
Is this identify listing equivalent to ImageMagick's "image profile"?
I have just been trying to digest http://imagemagick.org/Usage/formats/#profiles,
and I see in this old mail post http://studio.imagemagick.org/pipermail ... 20581.html
Anthony says
For example EVEN IM will save a very small profile containing an images
virtual canvas size for use by later IM applications.
Is this listing of Page Geometry you point me to the same as what he is referring to or is it elsewhere in another profile??
ta
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to see virtual canvas info in png metadata

Post by fmw42 »

No, "profiles" in IM are something else. They control color. However, I have never used them.

I believe Anthony was not actually referring to profiles, but to whatever information is kept in the (png) image header (and can be seen by -verbose) regarding the virtual canvas i.e. page geometry. But I will defer to him on what he meant in that topic.

Nevertheless, see information on virtual canvas at

http://www.imagemagick.org/Usage/formats/#png_offsets
http://www.imagemagick.org/Usage/crop/#crop_repage
http://www.imagemagick.org/Usage/crop/#crop_viewport

and -page and -repage at
http://www.imagemagick.org/Usage/anim_basics/#gif_anim

as well as at

http://www.imagemagick.org/script/comma ... s.php#page
http://www.imagemagick.org/script/comma ... php#repage
tobycarr

Re: How to see virtual canvas info in png metadata

Post by tobycarr »

Great help - thank you.
I'll follow your leads and would be interested to hear from Anthony if the image header's Page Geometry listing is what he was referring to in his old mail post..
ta muchly
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to see virtual canvas info in png metadata

Post by anthony »

tobycarr wrote:Hi,
Is there a way to see what the virtual canvas settings are for a png image using say, identify?
I can see the line in the identify output that says size e.g. Geometry: 1000x1000+0+0
Is this it? the +0+0 being the virtual canvas??
Doesn't seem to correlate with images that appear to have virtual canvases ( based on their reactions to certain commands and their adjusted reactions after repaging) having geometry settings of nxn+0+0.
Thanks

The 100x100 is the size of the virtual canvas whcih ranges from the 'virtual origin' 0,0 to 100,100.
In animations it set the image viewing area for GIF image displays, even if the actual image itself is al lot smaller.

the +0+0 refers to the offset of the top-left corner from the virtual origin. In this case the origin itself.

In GIF offsets can not be negative, and it is quite valid to offset an image completely beyond the bounds of the canvas itself. For PNG and other image formats supporting a vitural offset can be negative! offseting the image above or to the right of the canvas area. However a PNG normally does not save the canvs size, (but IM does save that info in the PNG files it generates)

Canvas size and offsets are typically only used for animations, and layered images. They are not gravity effected, and are always relative to the 'virtual origin'. they can involve any number of images in a group or sequence.

NOTE Alpha composition is different and ignores virtual canvas and offset information, composing TWO IMAGES ONLY with a geometry offset and gravity relative to each other.

The -layer composite method merges the two to compose two separate sequences of layer images. In that case the geometry offset (gravity effected) is used to align virtual canvases, rather than the actual images, which are being composited together, with virtual offsets on their respective virtual canvas.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
tobycarr

Re: How to see virtual canvas info in png metadata

Post by tobycarr »

thanks - wow, there sure is some complexity and a huge range of options to the IM world - due I guess to IM's legacy as part all-in-one wonder tool for animated gifs??
Post Reply