4

My goal is to create a Tiff image that natively holds uncompressed (or with lossless compression) YCbCr data inside (since the original image is YUV420 and IMO it would be a poor choice to upsample and convert to RGB). I’m able to create (using imagemagick for instance) a valid YCbCr Tiff with a JPEG compressed data. When I try uncompressed / deflate / lzw I get a broken image (neither windows image viewer nor photoshop can open it). On page 94 of the TIFF 6.0 spec (under “Minimum Requirements for YCbCr Images”):

Compression = none (1), LZW (5) or JPEG (6). SHORT.

What’s wrong? Is there a Tiff extension which says that YCbCr color space is supported only when using jpeg compression?

Thanks, Mark.


Command that works:

convert infileRGB.tif -colorspace ycbcr -compress jpeg outfileYCbCr.tif

Commands that don't work (broken tiff):

convert infileRGB.tif -colorspace ycbcr -compress none outfileYCbCr.tif
convert infileRGB.tif -colorspace ycbcr -compress lzw outfileYCbCr.tif
Mark
  • 1,540
  • 2
  • 13
  • 21
  • What actual commands are you using? I mean both those that work and those that do not. – Mark Setchell Aug 24 '15 at 12:46
  • @MarkSetchell I've added the commands to the bottom of the message. – Mark Aug 24 '15 at 12:50
  • My imaging library should support YCbCr uncompressed or LZW/Flate compressed. Please post a sample image and I'll take a look. – BitBank Aug 24 '15 at 12:58
  • @BitBank please take it from here: https://drive.google.com/file/d/0BwFf2UPDpHJKQ0R6Yjdyb2xIM0k/view?usp=sharing – Mark Aug 24 '15 at 13:10
  • Try adding `-type TrueColor` after the `-compress lzw` – Mark Setchell Aug 24 '15 at 13:13
  • @MarkSetchell This command forces it back to RGB (the resulted Tiff has PhotometricInterpretation: RGB instead of YCbCr) – Mark Aug 24 '15 at 13:27
  • @Mark I don't have ImageMagick installed. Can you please share the converted files? – BitBank Aug 24 '15 at 13:43
  • Interesting. If I use `convert ... -compress lzw ...` I get an unreadable file, but if I use `convert ... -compress none ...` I get a readable file and can run `exiftool -S -PhotometricInterpretation outfileYCbCr.tif` and it reports `PhotometricInterpretation: YCbCr`. Version: ImageMagick 6.9.1-10 – Mark Setchell Aug 24 '15 at 13:54
  • @BitBank the converted image: https://drive.google.com/file/d/0BwFf2UPDpHJKTmhBNzA2YmprLTQ/view?usp=sharing – Mark Aug 24 '15 at 13:54
  • I ran `convert tstRGB.tif -colorspace ycbcr -compress none result.tif` and the result is here.. https://www.dropbox.com/s/efmhdr9pcxbjrlh/result.tif?dl=0 – Mark Setchell Aug 24 '15 at 14:42
  • Thanks @MarkSetchell , this is the exact result I get, but the file cannot be viewed in photoshop cs6, ms paint, windows image viewer (win 7). – Mark Aug 24 '15 at 14:52
  • Mmmm, Photoshop CC (current version) cannot handle it either, but OS X Preview app can display it fine. – Mark Setchell Aug 24 '15 at 14:58
  • Is the image supposed to look inverted, like on Google Drive or in OS X Preview? Using my own Java TIFF plugin, it looks just like the original RGB one (would be fun to test with the LZW/Deflate versions). But I suspect YCbCr TIFF without JPEG compression is a little exotic... ;-) – Harald K Aug 25 '15 at 17:58

0 Answers0