How to select Black&White images via metadata?

Started by ubacher, August 11, 2016, 07:30:12 PM

Previous topic - Next topic

ubacher

I was looking into Metadata which tells that a jpg image is black and white.
For jpg images converted to B&W using the MODE:Grayscale in photoshop I found
[ICC-header]    Color Space Data                : GRAY

but when the image is converted to B&W via camera raw this still shows as RGB.

I found the following:
[XMP-crs]       Convert To Grayscale            : True

and
[XMP-crs]       Gray Mixer Red                  : -8 (several items, for each color)

This metadata is however not imported by Imatch!
If there is no other metadata which indicates a B&W image I suggest that Imatch import these lines from the metadata "XMP-crs".

Mario

IMatch by default imports the all standard XMP data, but skips most proprietary and rarely used name spaces to avoid flooding the database with junk data not intended to be read by humans.

The XMP-crs namespace is a proprietary namespace that belongs to Adobe. It contains development information and other data only useful only for Lr. Since this namespace often contains hundreds of data elements, importing it completely would increase the size of IMatch databases considerably and reduce overall performance. There can be several Kilobytes per file, and you won't have that in your IMatch database...

If you want to see tags Lr writes into your files, enable the group (ExifTool names it "Photoshop Camera Raw namespace") or enable only the tags (recommended) you want to see in IMatch.

Go to Edit > Preferences > Metadata 2 : Tag Manager. Then reload the metadata for your files. See "Tag Manager" in the IMatch help for details.

Is IMatch not great? Everything is possible. Try that in another DAM application  :)
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

Thank you!
I was looking for the tag name but I looked under the wrong name.
In addition the presence of the XMP-crs nametag confused me.  See screen shot.
This tag XMP-crs:ToneCurve....  appears on the left (*enabled by default) and on the right???

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

Sorry. Here the missing screenshot which shows on the right the Photoshop Camera Raw tags.
As can be seen the tag XMP-crs:ToneCurve.... also shows on the left side.

Mario

I can't see this in any of my 10 test databases.
Maybe your database is messed up or something. Just ignore it.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Winfried

Finding out whether an image is grayscale is not an easy task, because it depends.
"normally" 8-bit or 16-bit images are considered to be grayscale, i.e. just one color component:
{File.MD.JPEG::SOF\ColorComponents\ColorComponents\0}
{File.MD.JPEG::SOF\BitsPerSample\BitsPerSample\0}
So far it is quite easy.

But if you convert this "true" grayscale images to color, because some functions or filters just work on color images, you are lost.
It is still the same content, but no longer (technical) grayscale.
For example I normally use to tint my grayscale images to reproduce the look of ancient analog black-and-white papers.
Or think of color key images.

Using these Adobe fields might do whithin the Adobe universe, but what happens to these fields if you convert a grayscale image to a color image?
Or you you some plugin (Nik filter) to give your image a special black-and-white look?

Winfried 

ubacher

I realize that there is no sure-fie way to automatically detect a B&W image. But I might as well use all
metadata which will indicate at least some of these images.

Mario

There is no general solution because metadata can be wrong, and 8 bits per pixel is also used by some color formats which use a palette.  And a true black and white image only uses 0 or 1 for each pixel. What you mean is a gray scale image, actually. There are also grayscale images which are not really gray scale, but are just (half-)toned that way by the embedded ICC profile.

The only (partially) reliable generic solution is to inspect every pixel and then try t figure it out. But even that may not be possible, if the gray scale conversion was not done using the standard (R + G + B) / 3 rule (all channels have the same value) but using a Luminosity, Lightness or whatever method.

But for your own images you should be able to find a way to tell from the metadata I guess.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

jeknepley

Not "via metadata", but have you tried using IM's Sketch Match search tool? The sketch itself isn't that important as long as it's done using just the black, white & gray color options. Varying the "sketch" will vary the results, but they'll still be B&W.

Also, try the Visually Similar image search tool with different B&W images as the target.

The above two search the entire DB. To search only the current file window use the filter panel's Color filter option (obviously using just B, W, and gray).

If you don't already have a general B&W category, it's something else to consider.


ubacher

These are good suggestions. I did not even know about the color filter.
I tried the color filter but found it next to useless (?)
The sketch option and the similar images do return reliable b&w images but only some. Thus
I can not use them to select out B&W images of any kind.

I will put in a feature request. Maybe it would not be too much of a job to do for Mario.

(Background: If I convert a NEF file which has been used to generate a B&W image i.e. ConverttoGray set true,
to a compressed DNG file, the resulting file is unusable/unreadable/hangs the system! This is the reason I
need to filter out B&W images: to set ConvertoGray to false before I do the conversion. I now ingest this metadata
so that I can filter on it. )

sinus

Quote from: Mario on August 12, 2016, 02:17:16 PM
But for your own images you should be able to find a way to tell from the metadata I guess.

I use for such things simply a metadatafield, what I and the system does not really need and write in this field
"grayscale" or
"black and white"

and it is done.

I love metadata-fields for such things. I do also write other stuff in some fields like e.g.
- private delivered to ...
- special client filename
- is online at ...
and so on.

For infos, what another not should see, I use Attributes.
Best wishes from Switzerland! :-)
Markus

Mario

Quote from: ubacher on August 13, 2016, 08:53:28 AM
I will put in a feature request. Maybe it would not be too much of a job to do for Mario.
This is actually nearly impossible to do, for the general case. See my comment for your FR. A B&W image, by the way, has only fully black or fully white pixels (Black ink on white paper). Every other color would make it "grayscale".
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

jch2103

I don't know if this helps with the original request, but ImageMagick has an 'identify' command line parameter that supposedly returns color channel information: http://www.imagemagick.org/script/identify.php

I haven't tried this myself, and using it would require some extra steps to add results to desired metadata tags.
John

Erik

I have two solutions that I use.

1. When I export images that I consider "black and white" (grayscale), I name (or rename if I need to) with a file name that is specific to a version definition for black and white images:

"Original-Filename_b1.jpeg"  i.e. the "b" indicates the image is a black and white version of the Original-Filename.

2. For photos that are initially black and white (i.e. not versions), I have a category for black and white images that I filled in.  This category dates back to IM3.6, so I rarely assign images to it anymore.  Rather I have a formula category that captures these photos + the version set defined above to show "All" my black and white images.

Ultimately, it's all a bit arbitrary as I have to remember to export the images with the right name scheme.  But my workflow is such that it is hard to forget, and then in the future everything is just there, and I don't have to worry much about whether an image was potentially sepia toned or other. 

Finally, I used to use a metadata label, but I limit that now to images I want to process into black and white (grayscale).  Once I do that, I unset the label.  I like to use labels for tracking images I want to process since most software can see labels.