Page 1 of 1

Is there an efficient way to read back metadata of an output image?

Posted: 2018-12-08T11:13:54-07:00
by MarcG2
I'm using IM7 on Windows. Is there an efficient way to read back the metadata of an image as it's output from IM? I'm finding reading it back the standard way with the identify command (after a conversion) is slow when working with a large number of images. I noticed that if you add the -verbose switch to the convert command it will display some extra information, but that's not all the info I'm looking for. Is there a way a to tell IM to output specific metadata (similar to how Identify works) all in the convert command.

I'm looking into this because I'd like verification that IM is working as intended. If there is no way to do this, what's the easiest to speed up the identify command (in a script) when working with a large set of images? I could run multiple instances of IM at once, but it would be a pain to adjust all my scripts.

Re: Is there an efficient way to read back metadata of an output image?

Posted: 2018-12-08T11:25:58-07:00
by snibgo
What version of IM?

I think you mean that when you are writing an image to a file, you also want to write the "identify -verbose" text information. If so, then simple insert "-verbose +write info: -verbose" before your output filename.

If you want more limited information you can "-format XXX +write info:" where XXX is any text, including escapes shown at http://www.imagemagick.org/script/escape.php

EDIT: This writes information (metadata) about the image in memory. This generally isn't all written to the image file, because not all file formats support all the metadata.

Re: Is there an efficient way to read back metadata of an output image?

Posted: 2018-12-08T12:24:09-07:00
by MarcG2
Thanks for your help. I'm using 7.0.8-14 specifically (windows). I added the -verbose statement you suggested and this is my output below. In my test, I'm converting a x2600 PNG (gray scale) to a x2000 JPEG file. The output below seems to be for the down-scaled PNG(?) rather than the final JPEG file. Although some of my JPEG settings are in there such as quality and interlace, none of the JPEG specific properties are listed. Is there a way to specify which version of the image in memory to read?

Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 1409x2000+0+0
Units: Undefined
Colorspace: Gray
Type: Grayscale
Base type: Undefined
Endianess: Undefined
Depth: 8/16-bit
Channel depth:
Gray: 16-bit
Channel statistics:
Pixels: 2818000
Gray:
min: -44.3202 (-0.173805)
max: 299.056 (1.17277)
mean: 217.133 (0.851503)
standard deviation: 77.2133 (0.302797)
kurtosis: 2.64024
skewness: -2.01463
entropy: 0.435765
Rendering intent: Undefined
Gamma: 0.454545
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: none
Interlace: Plane
Intensity: Undefined
Compose: Over
Page geometry: 1409x2000+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Quality: 90
Orientation: Undefined
Properties:
date:create: 2018-11-24T14:36:33-05:00
date:modify: 2018-10-25T20:25:04-04:00
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 0
png:IHDR.color_type: 0 (Grayscale)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 1832, 2600
signature: d00f020055f12de00f691a62c175dcc353917b2ee7e8b9abbf0f03496e559e9e
Artifacts:
verbose: true
Tainted: True
Filesize: 0B
Number pixels: 2818000

Re: Is there an efficient way to read back metadata of an output image?

Posted: 2018-12-08T12:48:06-07:00
by snibgo
The information you get is metadata about the image in memory. This includes some info about where the image came from eg PNG.

IM doesn't give much information about files or what is stored in them.

If you want metadata about the JPG file that has been written, exiftool is probably a better tool for you.