Reputation: 5097
I have an image of an orange fabric, which I need to use in a program that uses the skimage library. The full file is here: https://storage.googleapis.com/color-mapping/src-colors/poly/Orange.tif
If I write a program that simply reads in the image and writes it, like follows:
from skimage import io
img = io.imread(path)
io.imsave(outpath, img)
The image that comes out appears to have dulled colors compared to the original when viewed on my OS X computer.
On OS X, I have found a command which appears to transform the image in such a way that the problem no longer appears to occur:
sips -m /System/Library/ColorSync/Profiles/sRGB Profile.icc img.tif --out img-srgb.tif
I am attempting to automate a process on a Linux cloud computer, and need an equivalent command line (or Python function). I've attempted to use imagemagick convert, but since I don't really understand the problem, I'm having trouble figuring out what I want to tell it to do.
The output of imagemagick identify for this image is as follows:
Image: scratch/gcs/src-colors/poly/Orange.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 5760x3840+0+0
Resolution: 240x240
Print size: 24x16
Units: PixelsPerInch
Type: TrueColor
Base type: TrueColor
Endianess: MSB
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 37 (0.145098)
max: 255 (1)
mean: 161.395 (0.632923)
standard deviation: 31.9903 (0.125452)
kurtosis: 0.330666
skewness: -0.638406
Green:
min: 0 (0)
max: 166 (0.65098)
mean: 56.2109 (0.220435)
standard deviation: 21.8988 (0.0858777)
kurtosis: 0.0542889
skewness: -0.481283
Blue:
min: 0 (0)
max: 126 (0.494118)
mean: 5.63112 (0.0220828)
standard deviation: 11.5607 (0.045336)
kurtosis: 2.85701
skewness: 1.97321
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 74.4125 (0.291814)
standard deviation: 23.3566 (0.0915944)
kurtosis: 139.8
skewness: 13.527
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 5760x3840+0+0
Dispose: Undefined
Iterations: 0
Compression: None
Orientation: TopLeft
Properties:
date:create: 2015-12-02T21:47:33+00:00
date:modify: 2015-12-02T21:47:33+00:00
exif:ApertureValue: 8.91886
exif:CustomRendered: 0
exif:DateTimeDigitized: 2015:09:28 22:50:19
exif:DateTimeOriginal: 2015:09:28 22:50:19
exif:ExposureBiasValue: 0
exif:ExposureMode: 1
exif:ExposureProgram: 1
exif:ExposureTime: 0.005
exif:Flash: 16
exif:FNumber: 22
exif:FocalLength: 70
exif:FocalPlaneResolutionUnit: 3
exif:FocalPlaneXResolution: 1600
exif:FocalPlaneYResolution: 1600
exif:ISOSpeedRatings: 1
exif:MaxApertureValue: 4
exif:MeteringMode: 5
exif:SceneCaptureType: 0
exif:ShutterSpeedValue: 7.64386
exif:SubSecTimeDigitized: 00
exif:WhiteBalance: 1
signature: bff167961ea4eb45101f9afc4761289d29e88f12cb91913b683aade8b80b4424
tiff:endian: lsb
tiff:make: Canon
tiff:model: Canon EOS 5D Mark III
tiff:photometric: RGB
tiff:rows-per-strip: 1
tiff:software: Adobe Photoshop Lightroom 6.1.1 (Macintosh)
tiff:timestamp: 2015:10:29 14:49:50
xmpMM:DerivedFrom:
Profiles:
Profile-8bim: 7774 bytes
Profile-icc: 560 bytes
Description: Adobe RGB (1998)
Manufacturer: Adobe RGB (1998)
Model: Adobe RGB (1998)
Copyright: Copyright 1999 Adobe Systems Incorporated
Profile-iptc: 64 bytes
City[1,90]: 0x00000000: 254700 -%
unknown[2,0]:
Created Date[2,55]: 20150928
Created Time[2,60]: 225019
unknown[2,62]: 20150928
unknown[2,63]: 225019
Profile-xmp: 11810 bytes
Artifacts:
filename: scratch/gcs/src-colors/poly/Orange.tif
verbose: true
Tainted: False
Filesize: 66.38MB
Number pixels: 22.12M
Pixels per second: 32.06MB
User time: 0.180u
Elapsed time: 0:01.690
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Disclaimer: I'm super unfamiliar with things like color profiles and colorpsaces, so this could obviously be an XY problem. Feel free to suggest a better solution to my underlying problem.
Upvotes: 1
Views: 714
Reputation: 5097
A solution that appears to have worked for me was to copy the file /System/Library/ColorSync/Profiles/sRGB Profile.icc
from OSX to my linux machine, and then run:
convert img.tif -profile sRGB\ Profile.icc img-srgb.tif
Still interested in learning more about the underlying problem and whether there is a better solution though.
Upvotes: 1