Identifying min-is-black Property Quickly
-
- Posts: 4
- Joined: 2016-09-27T04:55:48-07:00
- Authentication code: 1151
Identifying min-is-black Property Quickly
Hello
I am currently in the process of trawling through a very large number of TIFF drawings in order to identify those drawings which are black or inverse. ie. With a photometric attribute of min-is-black.
Other than using the "identify -verbose" command which provides all the attributes for each drawing, is there a quicker and alternative method for extracting this attribute alone ?
Thanks
Andy
I am currently in the process of trawling through a very large number of TIFF drawings in order to identify those drawings which are black or inverse. ie. With a photometric attribute of min-is-black.
Other than using the "identify -verbose" command which provides all the attributes for each drawing, is there a quicker and alternative method for extracting this attribute alone ?
Thanks
Andy
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Identifying min-is-black Property Quickly
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images. You can upload an image to some place such as dropbox.com and put your URL here.
Or just provide the output from identify -verbose yourimage and point out the information you want to extract from it. The verbose information can be parsed to get what you want.
Alternately, try EXIFTOOL. You might be able to extract that one piece of information from it.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620
For novices, see
viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
Or just provide the output from identify -verbose yourimage and point out the information you want to extract from it. The verbose information can be parsed to get what you want.
Alternately, try EXIFTOOL. You might be able to extract that one piece of information from it.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620
For novices, see
viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
Re: Identifying min-is-black Property Quickly
You could use exiftool rather than Imagemagick for this. Just grep 'Photometric Interpretation' and you'll find the info. This is faster than identify -verbose by 7.7x on my PC.
-
- Posts: 4
- Joined: 2016-09-27T04:55:48-07:00
- Authentication code: 1151
Re: Identifying min-is-black Property Quickly
Many Thanks Tom. I will give this a go.
Re: Identifying min-is-black Property Quickly
I love exiftool but it has one major drawback. It gets info from metadata - nothing less, nothing more.
If there is chance that metadata in images is false, eg. because some software package doesn't know it should update relevate Exif fields *ehem*, you should consider identify.
It is slower but gets real data from image.
If there is chance that metadata in images is false, eg. because some software package doesn't know it should update relevate Exif fields *ehem*, you should consider identify.
It is slower but gets real data from image.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Identifying min-is-black Property Quickly
In IM, though slow, this will get it for grayscale images.
(The grep and cut in the following are unix commands, though windows may have grep?)
min-is-black
This is faster and more direct and pure Imagemagick:
min-is-black
(The grep and cut in the following are unix commands, though windows may have grep?)
Code: Select all
identify -verbose DSC_0059_gray.tif | grep "tiff:photometric:" | cut -d: -f3
This is faster and more direct and pure Imagemagick:
Code: Select all
convert DSC_0059_gray.tif -format "%[tiff:photometric]" info:
-
- Posts: 4
- Joined: 2016-09-27T04:55:48-07:00
- Authentication code: 1151
Re: Identifying min-is-black Property Quickly
Many Thanks.
The aforementioned convert command works a treat and has literally shaved hours off the processing time.
The aforementioned convert command works a treat and has literally shaved hours off the processing time.
-
- Posts: 4
- Joined: 2016-09-27T04:55:48-07:00
- Authentication code: 1151
Re: Identifying min-is-black Property Quickly
We have discovered an anomoly however.
We are currently converting and resampling all of our TIFS to a standard 200 dpi using the following command :
convert -resample 200 sample.tif sample_new.tif
We then identify the black drawings using the command before negating them:
convert sample.tif -format "%[tiff.photometric]" info:
However, it appears that the convert resample command is changing the photometric value even though the visual colour has clearly not changed.
ie. a TIF image which is clearly white visually is returning a photometric of min-is-black
Why is the resample parameter changing the photometric value ?
Is this a known issue ?
The workaround is to identify the photometric on the original TIF before resampling.
We are currently converting and resampling all of our TIFS to a standard 200 dpi using the following command :
convert -resample 200 sample.tif sample_new.tif
We then identify the black drawings using the command before negating them:
convert sample.tif -format "%[tiff.photometric]" info:
However, it appears that the convert resample command is changing the photometric value even though the visual colour has clearly not changed.
ie. a TIF image which is clearly white visually is returning a photometric of min-is-black
Why is the resample parameter changing the photometric value ?
Is this a known issue ?
The workaround is to identify the photometric on the original TIF before resampling.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Identifying min-is-black Property Quickly
The default for writing tiff is min-is-black. If you want min-is-white, set it with "-define quantum:polarity=min-is-white". See http://www.imagemagick.org/script/comma ... php#define
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Identifying min-is-black Property Quickly
Proper IM syntax is to read the input raster image before any operations.convert -resample 200 sample.tif sample_new.tif