Page 1 of 1

Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-28T12:32:38-07:00
by tms
I'm struggling to figure out why some of our TIFF files (only ~30 out of 29,000) when converted to jpg using IM have blacked out areas in the jpg.

Image

I've compared the 'identify -verbose' output for this tiff file to many others which convert correctly, and I can't see any consistent differences (there are some differences obviously, but when looking at the bad files & comparing to good files I can't see anything that's consistently different on the bad files) .

Other things to note:
- I've tried -black-threshold from 0 to 100%, -alpha off, and a few other settings to no avail.
- If I convert these images using photoshop they convert correctly.

I've included urls for all the identify output below, but here's the identify -verbose for the original TIFF:

Code: Select all

Image: testImage.tif
  Format: TIFF (Tagged Image File Format)
  Class: DirectClass
  Geometry: 2806x3664+0+0
  Resolution: 300x300
  Print size: 9.35333x12.2133
  Units: PixelsPerInch
  Type: TrueColorMatte
  Base type: TrueColor
  Endianess: MSB
  Colorspace: RGB
  Depth: 16-bit
  Channel depth:
    red: 16-bit
    green: 16-bit
    blue: 16-bit
    alpha: 15-bit
  Channel statistics:
    red:
      min: 1038 (0.0158389)
      max: 65535 (1)
      mean: 29004.2 (0.442576)
      standard deviation: 14710.7 (0.22447)
      kurtosis: -1.3753
      skewness: 0.231452
    green:
      min: 3034 (0.0462959)
      max: 65535 (1)
      mean: 29365.6 (0.448091)
      standard deviation: 14602.5 (0.22282)
      kurtosis: -1.35783
      skewness: 0.207002
    blue:
      min: 2108 (0.032166)
      max: 65535 (1)
      mean: 29834.7 (0.455249)
      standard deviation: 14456.8 (0.220596)
      kurtosis: -1.32869
      skewness: 0.0866919
    alpha:
      min: 0 (0)
      max: 65535 (1)
      mean: 46483.7 (0.709295)
      standard deviation: 29750.5 (0.453963)
      kurtosis: -1.14971
      skewness: 0.921842
  Image statistics:
    OverAll:
      min: 0 (0)
      max: 65535 (1)
      mean: 26814 (0.409155)
      standard deviation: 20027.6 (0.305602)
      kurtosis: -1.00243
      skewness: 0.306242
  Alpha: rgba(45.5116%,38.0255%,31.9524%,0)   #7482615851CC0000
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgba(223,223,223,1)
  Matte color: grey74
  Transparent color: none
  Page geometry: 2806x3664+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: None
  Orientation: TopLeft
  Properties:
    create-date: 2009-07-28T15:15:49-04:00
    dc:format: image/tiff
    exif:ColorSpace: 4294967295
    exif:DateTimeDigitized: 2005-08-26T14:58:09-04:00
    exif:DateTimeOriginal: 2005-08-26T14:58:09-04:00
    exif:PixelXDimension: 3788
    exif:PixelYDimension: 5030
    modify-date: 2006-03-19T22:46:57-04:00
    photoshop:History: 
    signature: 18203faa436a406e20f0c141f96bdb5910bb99316a3b297c28e4d1a6cff25342
    stRef:documentID: adobe:docid:photoshop:2789d526-19fc-11da-baa8-f76d50735710
    stRef:instanceID: uuid:2789d527-19fc-11da-baa8-f76d50735710
    tiff:alpha: unassociated
    tiff:Make: Phase One
    tiff:Model: H 25
    tiff:rows-per-strip: 1
    tiff:software: Adobe Photoshop CS Macintosh
    tiff:timestamp: 2005:08:29 09:28:06
    xap:CreateDate: 2005-08-29T09:28:06-04:00
    xap:CreatorTool: Adobe Photoshop CS Macintosh
    xap:MetadataDate: 2005-08-29T09:28:06-04:00
    xap:ModifyDate: 2005-08-29T09:28:06-04:00
    xapMM:DocumentID: adobe:docid:photoshop:5f408659-1a01-11da-baa8-f76d50735710
  Profiles:
    Profile-8bim: 12226 bytes
    Profile-icc: 560 bytes
      Adobe RGB (1998)
    Profile-iptc: 8 bytes
      unknown[2,0]: 
    Profile-xmp: 6732 bytes
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 78.46mb
  Number pixels: 9.805mb
  Pixels per second: 33.01mb
  User time: 0.297u
  Elapsed time: 0:01
  Version: ImageMagick 6.5.2-8 2009-05-23 Q16 OpenMP http://www.imagemagick.org
I've uploaded samples to a temporary folder on our website. The files are:

http://ecatalogue.art.yale.edu/im/testImage.tif - the original tif, 80mb
http://ecatalogue.art.yale.edu/im/identify_tif.txt - the identify -verbose for this file

http://ecatalogue.art.yale.edu/im/testImage.jpg - the IM conversion
http://ecatalogue.art.yale.edu/im/identify_jpg.txt

http://ecatalogue.art.yale.edu/im/testImage-ps.jpg - the photoshop conversion
http://ecatalogue.art.yale.edu/im/identify_jpg-ps.txt

I'm hoping someone can point me in the right direction.
Thanks,
Tim

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-28T12:47:19-07:00
by magick
We can reproduce the problem you posted and will have a patch in the next point release within a week or two. Thanks.

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-28T12:50:18-07:00
by tms
You guys ROCK.
Thanks,
Tim

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-28T17:27:06-07:00
by magick
It appears the alpha channel of your image is negated from the TIFF standard where 0 is transparent and 65535 is opaque. Gimp, for example, returns blacked out areas as well. With the current ImageMagick release the conversion to JPEG works fine:
  • convert testImage.tif testImage.jpg
because the alpha channel is ignored. You can correct the alpha channel by negating it:
  • convert testImage.tif -channel a -negate testImage.png

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-29T07:58:00-07:00
by tms
I've downloaded the latest version of IM and tried:
convert testImage.tif -resize 300x300 -channel a -negate testImage.jpg
but still get the same result.

Is there a way to tell it "omit the alpha channel" ?

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-29T08:47:22-07:00
by magick
Add +matte to your command-line to omit the alpha channel. Also check to see if you have more than one version of ImageMagick installed in your system. Does
  • convert -version
return a version of 6.5.4-6?

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-29T09:06:46-07:00
by tms
Running:

convert testImage.tif -resize 300x300 +matte -channel a -negate testImage.jpg

still produces the same blacked out area. I also tried just:

convert testImage.tif -resize 300x300 +matte testImage.jpg

same result.

convert -version shows
Version: ImageMagick 6.5.4-6 2009-07-25 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-29T12:09:09-07:00
by magick
Order is important. Try
  • convert testImage.tif +matte -resize 300x300 testImage.jpg

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-29T13:26:00-07:00
by tms
Yep, it sure is. That worked. I'll run the rest of my problem tifs that way & see if that solves our problems.

FWIW, I didn't spot anything in the documentation about ordering of arguments, though I won't claim I read in great detail.

Thanks for all the help.
Tim

Re: Conversion of TIFF to jpg results in blacked out areas

Posted: 2009-07-30T21:20:40-07:00
by fmw42