Scans of 1970s photos: black is dark purple

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ThomasHR
Posts: 10
Joined: 2014-08-11T15:40:55-07:00
Authentication code: 6789

Scans of 1970s photos: black is dark purple

Post by ThomasHR »

I have several image files, of 1970s photos taken several years apart and developed in different places, that all have the same problem.

Most colors in the photo—bright yellow, green, blue, pink—are fine or are only slightly off. No problem.

White (such as the white border of the photo) has turned into a pale yellow. That's only a minor problem; a histogram will fix that.

But what is supposed to be black or a very dark version of another color, has turned into dark purple.

For instance, a girl's blond hair is yellow when it's in bright light, but turns dark purple when it's in shadow.

So my questions are twofold:

1) How do I create a mask based on "How close is this pixel's color to dark purple?"

2) Once I've created an temp-image where dark-purple pixels are opaque and not-dark-purple pixels are transparent, what's the best way to de-purpleize the temp-image?

Particulars: ImageMagick 6.8.9-6 Q16 x64 2014-07-22 under Windows 7 64-bit.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Scans of 1970s photos: black is dark purple

Post by snibgo »

(1) is easy, eg "-compose Difference" from an image the same size that is dark purple. (2) it depends on what "de-purpleize" means. Perhaps the best thing is to desaturate, and/or make it black.

If you put up a sample or two, suggestions can be more specific.
snibgo's IM pages: im.snibgo.com
ThomasHR
Posts: 10
Joined: 2014-08-11T15:40:55-07:00
Authentication code: 6789

Re: Scans of 1970s photos: black is dark purple

Post by ThomasHR »

snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Scans of 1970s photos: black is dark purple

Post by snibgo »

It looks to that the dyes have faded in proportion to their density. Photographs are, of course, subtractive, so a fading dye make the print lighter. A first-pass correction is the find the darkest pixels and make them black, adjusting the others in proportion. "-level-colors" does this.

Windows BAT syntax:

Code: Select all

set S1=cheryl-soft-light-and-shy-smile-1975-498x720.jpg
set S2=cheryl-smiling-close-up-balboa-park-san-diego-1975-730x474.jpg
set S3=cheryl-sitting-in-purple-skirt-by-palm-tree-balboa-park-san-diego-1975-crop-315x546.jpg
set S4=cherry-blossoms-in-japan-spring-1972-crop-672x665.jpg

convert %S1% -level-colors rgb(44%%,24%%,34%%),white t1.png
convert %S2% -level-colors rgb(31%%,13%%,20%%),white t2.png
convert %S3% -level-colors rgb(43%%,18%%,27%%),white t3.png
convert %S4% -level-colors rgb(29%%,19%%,16%%),white t4.png
I found the darkest colours with Gimp's eyedropper, by hand. IM could find the darkest individual pixel, but that might be an outlier. You can chop the image into lots of small (eg 4x4) squares, average each of these and find the darkest.

Code: Select all

%IM%convert %S1% -crop 4x4 +repage -resize "1x1^!" -compose Darken -layers merge +depth txt:
0,0: (42.8626%,21.3809%,28.4855%)  #6DBA36BC48EC srgb(42.8626%,21.3809%,28.4855%)
These percentages could be extracted with a script and used for the "+level-colors".

EDIT: I should add, instead of "white" in the "-level-colors", you cold use the actual lightest color in the print.
snibgo's IM pages: im.snibgo.com
Post Reply