-depth 32 on a 16 bit tiff produces unexpected results

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
GiantCowFilms
Posts: 17
Joined: 2017-02-28T22:08:29-07:00
Authentication code: 1151

-depth 32 on a 16 bit tiff produces unexpected results

Post by GiantCowFilms » 2017-03-01T18:40:28-07:00

I am attempting to convert a 16 bit tiff to a 32 bit tiff using image magick.

I ran

Code: Select all

magick convert in.tiff -depth 32 out.tiff. 
I tried this using Q16 HDRI and Q32 HDRI builds (both of version 7.0.5-0, and one build of an older version 7(something)). The resulting image opened alright in adobe photoshop, but did not work in luminance HDRI, windows photo viewers and several other applications (some outright refused to open it, while other such as windows photo viewer displayed bizarre results). Converting the depth back to 16 bit fixed all the issues however. I'm guessing this has something to do with the encoding.

Any ideas how to fix this? Thanks.

snibgo
Posts: 9392
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -depth 32 on a 16 bit tiff produces unexpected results

Post by snibgo » 2017-03-01T18:54:35-07:00

I think the problem is simply that some software doesn't know hot to properly read 32-bit/channel/pixel TIFFs.
snibgo's IM pages: im.snibgo.com

GiantCowFilms
Posts: 17
Joined: 2017-02-28T22:08:29-07:00
Authentication code: 1151

Re: -depth 32 on a 16 bit tiff produces unexpected results

Post by GiantCowFilms » 2017-03-01T19:24:04-07:00

snibgo wrote:
2017-03-01T18:54:35-07:00
I think the problem is simply that some software doesn't know hot to properly read 32-bit/channel/pixel TIFFs.
When I save the 32 bit out of photoshop it reads its fine - sorry I forgot to mention that.

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: -depth 32 on a 16 bit tiff produces unexpected results

Post by fmw42 » 2017-03-01T19:53:36-07:00

Snibgo is probably right.

But see http://www.imagemagick.org/script/formats.php#supported tif defines
To specify a single-precision floating-point format, use -define quantum:format=floating-point. Set the depth to 64 for a double-precision floating-point format.
Does that help?

To go to 32 bit integers (not floats) you only need Q32 not Q32 HDRI.

But I do not know how this relates to Imagick. I am not sure whether or not it can use HDRI and probably not IM 7.

Imagemagick and Imagick are two different tools. Imagick needs Imagemagick. Imagemagick does not need Imagick.

snibgo
Posts: 9392
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -depth 32 on a 16 bit tiff produces unexpected results

Post by snibgo » 2017-03-01T20:28:10-07:00

I'll mention that Gimp 2.9.3 (development version) is happy to read 32-bit integer, 32-bit float and 64-bit float images made by ImageMagick, and correctly reports them as such, and shows good pictures on the screen.

Microsoft Windows Photo Viewer reads 32-bit images but shows a bad picture, and for 64-bit images it says it can't read the file.
GiantCowFilms wrote:When I save the 32 bit out of photoshop it reads its fine - sorry I forgot to mention that.
If this means that PS can create 32-bit (integer or float?) images that some software (which software?) can read, but ImageMagick can't create them, perhaps there is something for IM developers to look at.

If so, perhaps you can provide URLs to sample files.

As Fred says, Imagick is a different beast, and might do something bad.
snibgo's IM pages: im.snibgo.com

GiantCowFilms
Posts: 17
Joined: 2017-02-28T22:08:29-07:00
Authentication code: 1151

Re: -depth 32 on a 16 bit tiff produces unexpected results

Post by GiantCowFilms » 2017-03-02T10:07:14-07:00

snibgo wrote:
2017-03-01T20:28:10-07:00
I'll mention that Gimp 2.9.3 (development version) is happy to read 32-bit integer, 32-bit float and 64-bit float images made by ImageMagick, and correctly reports them as such, and shows good pictures on the screen.

Microsoft Windows Photo Viewer reads 32-bit images but shows a bad picture, and for 64-bit images it says it can't read the file.
GiantCowFilms wrote:When I save the 32 bit out of photoshop it reads its fine - sorry I forgot to mention that.
If this means that PS can create 32-bit (integer or float?) images that some software (which software?) can read, but ImageMagick can't create them, perhaps there is something for IM developers to look at.

If so, perhaps you can provide URLs to sample files.

As Fred says, Imagick is a different beast, and might do something bad.
Photoshop saves them as float. And when I set them to float it worked in all the software. Apparently these programs do not like 32 bit integer tiffs. Thanks for all the help.

Post Reply