I use the identify
command of ImageMagick to retrieve exif of a photo. ImageMagick, unlike exiftool, returns sRGB
when the colorspace has been undeclared. How can I make ImageMagick return either Uncalibrated
or Unknown
or Undeclared
when it is the case?
Fred's right. You'll need to use some additional utilities (like awk) in addition to some -format [EXIF:*]
magick.
identify -format '%[EXIF:Col*ce]\n' input_file.tif | \
awk '{ if (length($0)) { print $0; exit } else { print "Uncalibrated" }}'
This works by invoking a query (*
) character which will attempt to return a list of key-matches. If the key EXIF:Colorspace
is set, awk will print it, else "Uncalibrated"
would be returned.
Another option is identify -debug Coder input_file.tif
which will dump all the data-points ImageMagick extracts from the image format. But that may be overkill.