YCbCr in JPEG compressed TIFF fail to be detected

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
cedricm
Posts: 3
Joined: 2012-10-26T03:21:37-07:00
Authentication code: 67789

YCbCr in JPEG compressed TIFF fail to be detected

Post by cedricm » 2012-10-26T04:35:04-07:00

Hi,

I've a set of TIFF files containing JPEG encoded images in the YCbCr color space that don't get properly read/resized by ImageMagick. I get some color cast in the output due to wrong color space.
Other tools like The Gimp are fine with those images.

Using either ImageMagick 6.7.7-10 or 6.8.0-2, I can get ImageMagick process those images properly only if I force the YCbCr colorspace:
$ convert source.tif -set colorspace YCbCr -resize 800x600 out.jpg

With ImageMagick 6.6.9-7, I couldn't get correct colors at all (any idea of how I can process them with this version?).

Running ImageMagick 6.8.0-2's identify gives the following:

$ identify -verbose source.tif
Image: source.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 7210x5410+0+0
Resolution: 300x300
Print size: 24.0333x18.0333
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:
[...]
Image statistics:
[...]
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: 7210x5410+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Orientation: TopLeft
Properties:
[...]
dc:format: image/tiff
exif:ApertureValue: 8
exif:ColorSpace: -1
exif:ExifVersion: 0210
[...]
jpeg:sampling-factor: 1x1
photoshop:ColorMode: 3
photoshop:DateCreated: 2009-07-19
photoshop:History:
photoshop:ICCProfile: Adobe RGB (1998)
[...]
tiff:artist: powerbook
tiff:Compression: 7
tiff:endian: msb
tiff:ImageLength: 5410
tiff:ImageWidth: 7210
[...]
tiff:photometric: YCBCR
tiff:PhotometricInterpretation: 6
tiff:PlanarConfiguration: 1
tiff:rows-per-strip: 48
tiff:SamplesPerPixel: 3
tiff:software: Adobe Photoshop CS3 Macintosh
[...]
Profiles:
Profile-8bim: 15644 bytes
Profile-icc: 560 bytes
Adobe RGB (1998)
Profile-iptc: 64 bytes
[...]
Profile-xmp: 16746 bytes
[...]
Version: ImageMagick 6.8.0-2 2012-10-26 Q16 http://www.imagemagick.org
$

ExifTool reports:
$ exiftool -a -G0 source.tif
[ExifTool] ExifTool Version Number : 8.60
[...]
[EXIF] Subfile Type : Full-resolution Image
[EXIF] Image Width : 7210
[EXIF] Image Height : 5410
[EXIF] Bits Per Sample : 8 8 8
[EXIF] Compression : JPEG
[EXIF] Photometric Interpretation : YCbCr
[...]
[EXIF] JPEG Tables : (Binary data 558 bytes, use -b option to extract)
[EXIF] Y Cb Cr Sub Sampling : YCbCr4:4:4 (1 1)
[EXIF] Y Cb Cr Positioning : Co-sited
[...]
[XMP] Format : image/tiff
[XMP] Date Created : 2009:07:19
[XMP] Color Mode : RGB
[XMP] ICC Profile Name : Adobe RGB (1998)
[XMP] History :
[XMP] Image Width : 7210
[XMP] Image Height : 5410
[XMP] Bits Per Sample : 8, 8, 8
[XMP] Compression : JPEG
[XMP] Photometric Interpretation : YCbCr
[XMP] Samples Per Pixel : 3
[XMP] X Resolution : 300
[XMP] Y Resolution : 300
[XMP] Resolution Unit : inches
[...]
$

From what I see, the colorspace reported by EXIF/XMP metadata is not used, and ImageMagick seems to think that the image is a sRGB one.

Thanks,

Cedric

User avatar
magick
Site Admin
Posts: 11063
Joined: 2003-05-31T11:32:55-07:00

Re: YCbCr in JPEG compressed TIFF fail to be detected

Post by magick » 2012-10-26T06:28:01-07:00

Post a URL to one or two of your images. We need to download them and reproduce the problem before we can comment.

cedricm
Posts: 3
Joined: 2012-10-26T03:21:37-07:00
Authentication code: 67789

Re: YCbCr in JPEG compressed TIFF fail to be detected

Post by cedricm » 2012-11-01T03:00:23-07:00

Hi,

Link to such an image sent in a private message!

Thanks!

User avatar
magick
Site Admin
Posts: 11063
Joined: 2003-05-31T11:32:55-07:00

Re: YCbCr in JPEG compressed TIFF fail to be detected

Post by magick » 2012-11-01T03:23:10-07:00

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.0-4 Beta available within a few days. Thanks.

cedricm
Posts: 3
Joined: 2012-10-26T03:21:37-07:00
Authentication code: 67789

Re: YCbCr in JPEG compressed TIFF fail to be detected

Post by cedricm » 2012-11-01T03:48:23-07:00

That's great, thanks!!

Post Reply