从Adobe RGB转换颜色配置文件,以便在Linux上的Skimage中读取

时间:2015-12-03 16:41:43

标签: colors imagemagick

我有橙色面料的图像,我需要在使用skimage库的程序中使用它。完整文件位于:https://storage.googleapis.com/color-mapping/src-colors/poly/Orange.tif

如果我编写的程序只是读入图像并将其写入,如下所示:

from skimage import io
img = io.imread(path)
io.imsave(outpath, img)

在我的OS X计算机上查看时,出现的图像与原始图像相比显得比较暗淡。

在OS X上,我找到了一个命令,它似乎会以不再出现问题的方式转换图像:

sips -m /System/Library/ColorSync/Profiles/sRGB Profile.icc img.tif --out img-srgb.tif

我正在尝试在Linux云计算机上自动化进程,并且需要等效的命令行(或Python函数)。我试图使用imagemagick转换器,但由于我不能真正理解这个问题,因此我无法弄清楚我想告诉它做什么。

此图像的imagemagick识别输出如下:

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

免责声明:我不熟悉颜色配置文件和colorpsaces之类的东西,所以这显然是一个XY问题。请随意为我的潜在问题提出更好的解决方案。

1 个答案:

答案 0 :(得分:1)

似乎对我有用的解决方案是将文件/System/Library/ColorSync/Profiles/sRGB Profile.icc从OSX复制到我的linux机器,然后运行:

convert img.tif -profile sRGB\ Profile.icc img-srgb.tif

仍然有兴趣了解有关潜在问题的更多信息以及是否有更好的解决方案。