Page 1 of 1

Imprint Identify output into image

Posted: 2016-09-01T09:13:17-07:00
by HarryS
Hi,

I am new to IM and I have a folder with some hundred images that need to be analysed.
I want IM to create copies of these images with the imprinted information of the "indetify -verbose image.tif" output.

How to do that ?

Thanks !!

Re: Imprint Identify output into image

Posted: 2016-09-01T09:26:33-07:00
by snibgo
You can write text from identify to a file, then use one of the methods shown on http://www.imagemagick.org/Usage/text/ to write the text in that file to an image. For example:

Code: Select all

identify -verbose r.tiff >t.txt

convert r.tiff -background None label:@t.txt -gravity Center -layers merge withtext.tiff
Or you can do this in one step, with piping.

Re: Imprint Identify output into image

Posted: 2016-09-01T09:29:08-07:00
by fmw42
The verbose information is rather long. Where do you want to put that information? In a meta tag such as the comment tag or imbedded onto the pixel data so that it shows in the image? If your image is not very big, that much text may not be readable if imbedded onto the image

Please always provide your IM version and platform, since syntax may differ.

If imbedded, as snibgo shows, then I would use caption: so that it wraps to the size of your image or some specified width and or height rather than label:, which will try to put it all in one line.

Re: Imprint Identify output into image

Posted: 2016-09-01T12:02:24-07:00
by HarryS
Thanks,

I am using IM 7 on a Win64 DOS shell.

I want the stats embedded in pixeldata, images are about 5000x5000 pixels.
I guess snibgos solution with caption: will work for me. Will try tomorrow.

Re: Imprint Identify output into image

Posted: 2016-09-01T13:02:03-07:00
by fmw42
label: also works (because that text has line breaks), but you may want to specify a pointsize or the height of the image to the text part so that it is readable as desired.

Perhaps you should post your image to some free hosting service such as dropbox.com and put the URL here so we can access your image to help you further.

Re: Imprint Identify output into image

Posted: 2016-09-01T13:12:29-07:00
by snibgo
You may also need other refinements, eg because black text doesn't show clearly against dark images.

Re: Imprint Identify output into image

Posted: 2016-09-02T00:57:19-07:00
by HarryS
Thanks,

Code: Select all

identify -verbose r.tiff >t.txt
convert r.tiff -background None -size 5000x5000 -fill white -gravity Center label:@t.txt -layers merge withtext.tiff
works for me perfectly.

This brings me to another question:
How can I embedd a histogram into these images (instead of the identify output) ?

Re: Imprint Identify output into image

Posted: 2016-09-02T01:18:35-07:00
by snibgo
By "histogram", do you mean the histogram text data, or a histogram image?

Code: Select all

convert input.png -define histogram:unique-colors=true histogram:info:h.txt
h.txt is histogram text data.

Code: Select all

convert input.png -define histogram:unique-colors=false histogram:h.png
h.png is a histogram image.

You can "-composite" an image over another, eg:

Code: Select all

convert input.png h.png -composite out.png
("histogram:" is an output coder that writes to a file or pipe, not an option that creates an in-memory image, so we can't read an image, create its histogram image, and composite them together in a single convert command, as far as I can see.)