However, I'm not quite sure what the magickal combination of command line parameters is to get this to work without mutating colors....vips always uses YCbCr coding for jpeg. It lets you enable chrominance subsampling and gets you another factor of two or so compression (from memory) with no quality loss. It's really a bug not to use it, in my opinion.
I've succeeded in creating a TIFF that uses JPEG compression and the ycbcr colorspace and there is a fantastic reduction in file size but there are problems with the resulting colors in both IM 188.8.131.52 and IM 7.0.7-2.
Here's a simple reproducible case using only IM commands rather than my source image:
Create a rainbow in a new uncompressed tiff file
convert \( xc:red xc:blue +append \) \( xc:yellow xc:cyan +append \) -append -filter triangle -resize 1000x1000\! rainbow.tif
Create an uncompressed pyramidal tiff out of it (works fine without colors getting shifted)
convert rainbow.tif -define tiff:tile-geometry=256x256 ptif:standard_tiff_rainbow.ptif
And converting to ycbcr colorspace and reducing depth to 8 also seems to work fine too without shifting colors
convert rainbow.tif -define tiff:tile-geometry=256x256 -set colorspace ycbcr -colorspace ycbcr -depth 8 ptif:ycbcr_tiff_rainbow.ptif
But, adding JPEG into the mix causes red to turn to green, blue to turn red, etc.
convert rainbow.tif -define tiff:tile-geometry=256x256 -set colorspace ycbcr -colorspace ycbcr -depth 8 -compress jpeg -quality 85 ptif:ycbcr_tiff_with_jpeg_100_rainbow.ptif
interestingly, this doesn't seem to have to do with chroma subsampling since using -quality 100 produces similar color-shifted results.
If I set the first colorspace to sRGB, I get results that more closely match the original colors and using set colorspace RGB seems to fix the color shifting entirely.
Can someone explain what's going on here? I still need to test this last option with actual color profiles embedded in the source images and if there are some tweaks to this process to ensure colors match all the way from the original source image, I'd appreciate the assistance.