tiffs not viewable in some software

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
codycuellar
Posts: 3
Joined: 2017-05-18T12:28:07-07:00
Authentication code: 1151

tiffs not viewable in some software

Post by codycuellar »

Hi all, brand new to ImageMagick. After struggling to accomplish my goal in Pil for Python, I decided to give ImageMagick a try. So far, everything worked beautifully, until I found out the two apps I need to use my generated TIFFs won't display them correctly. What I have is a library of floating point RGB value color patches in a Python app I'm developing. I'm passing a command to ImageMagick to create different sequences of colors with 16-bit precision. Here's a basic version of my command:

Code: Select all

convert -size 1920x1080 -depth 16 canvas:black -fill white -draw 'rectangle 100,100 500,500' test.tiff;
Photoshop and Preview have no problems displaying it, but Nuke and Resolve are seeing the second image.

Image
Image


In FFMPEG I'm seeing pix_fmt as ya16le for all the imagemagick TIFFs. When I re-save it in Photoshop (which in turn is viewable in Resolve and Nuke) shows as rgb48le.

I've messed around with both -define tiff:fill-order=msb|lsb and -define tiff:endian=msb|lsb and tried different combinations of msb and lsb. Nothing affects the results. Any ideas would be greatly appreciated, thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: tiffs not viewable in some software

Post by fmw42 »

What version of ImageMagick? Perhaps those viewers do not like binary images. You could try adding -type truecolor before your output and see if that helps. Also add -alpha off after -draw, since -draw always leaves an alpha channel even though in this case it is opaque. Also try adding -compress none to be sure you do not have a compressed tif, which your other viewers may not like.
codycuellar
Posts: 3
Joined: 2017-05-18T12:28:07-07:00
Authentication code: 1151

Re: tiffs not viewable in some software

Post by codycuellar »

AMAZING! Thank you so much, I literally would never have found that option. -type truecolor seems to be the ticket. It reads in Resolve and ffprobe reads the pix_fmt as rgb48le like the Photoshop outputs. I'll check tomorrow if it works in Nuke too. As long as I can verify in Nuke that I'm getting proper 16-bit accuracy, this will be a perfect solution for generating my test images! Curious that this isn't mentioned anywhere in the docs that I have seen yet, but I'll do some more research on the -type option. Thanks again!

Just for reference, version:

ImageMagick 7.0.5-6 Q16 x86_64 2017-05-13
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: tiffs not viewable in some software

Post by fmw42 »

Some tools/viewers/browsers are particular about TIFF files. Binary files are one issue. Transparency is another issue. And compression is another issue. One never knows which tools need which. But typically a 24-bit color tiff with no compression will work, but may be a larger file than you want. Often tiff files are readable if 24-bit and LZW compressed. So you can try different compressions. Turning alpha off saves some space if the file is truly opaque. You may also get by using a grayscale (not binary) file, so you can try also -type grayscale.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: tiffs not viewable in some software

Post by snibgo »

I'll mention that exiftool is useful for finding the format of the image file that is created.

Code: Select all

convert -size 1920x1080 -depth 16 canvas:black -fill white -draw "rectangle 100,100 500,500" {options} test.tiff

exiftool test.tiff
Look for the "Bits Per Sample" line.

no options gives "16 16" (grayscale + alpha)

{options}="-alpha off" gives "16" (grayscale only)

{options}="-type truecolor" gives "16 16 16" (RGB channels)
snibgo's IM pages: im.snibgo.com
codycuellar
Posts: 3
Joined: 2017-05-18T12:28:07-07:00
Authentication code: 1151

Re: tiffs not viewable in some software

Post by codycuellar »

I did some research, and turn out that the default behavior for IM is to find the most efficient encoding type, which is why it was doing the ya16le pixel format, which is incompatible with Nuke and Resolve. Forcing it to truecolor keeps it rgb16le, which is fine. I disabled alpha for good measure, and even was able to do zip compression since I'm generating mostly solid colors. Seems to all work well. And thanks for the tip on exiftool snibgo - I'll definitely check it out.
Post Reply