badperson
badperson

Reputation: 1614

imagemagick convert : tiff warnings / multiple output files created

I am working on a java application that uses the ImageMagick convert utility to convert tiff to jpg.

Our workflow is to first do the tiff->jpg; create buffered img obj in order to get dimensions, then scale new dimensions, and run convert again to resize with the new dimensions and a few other options.

This works well the vast majority of the time, but in some cases I'm getting some tiff warnings, and while the img conversion is ultimately successful, convert creates a couple of interim images that are a problem. Here is what it looks like on the command line:

>convert testImg.tif test.jpg
convert.exe: Unknown field with tag 317 (0x13d) encountered. `TIFFReadDirectory @ warning/tiff.c/TIFFWarnings/824.
convert.exe: Unknown field with tag 34391 (0x8657) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/824.
convert.exe: Unknown field with tag 34392 (0x8658) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/824.
convert.exe: testImg.tif: Null count for "Tag 34391" (type 1, writecount -3, pascount 1). `_TIFFVSetField' @ error/tiff.c/TIFFErrors/562.
convert.exe: Unknown field with tag 317 (0x13d) encountered. `TIFFReadDirectory @ warning/tiff.c/TIFFWarnings/824.

when starting with

testImg.tif

the outputs are

test-0.jpg
test-1.jpg

our workaround is to do the first conversion tif->gif then gif->jpg and that seems to fix it, but was wondering if anyone had come across this particular issue.

As an aside, we're using the convert util because we found JMagick to be very unreliable. If anyone has successfully used that, would be interested to hear any ideas about how to inforporate.

thanks! bp

Upvotes: 1

Views: 2812

Answers (1)

JSG
JSG

Reputation: 430

I'm not a java expert at all but have ran into the multiple images problem with imagemagick. This is due to tiff files containing layers. imagemagick will output every layer within the tiff. To get a specific layer and only 1...

convert image.tif[0] image.jpg

Now this may affect quality. You may want to convert both and for each layer made, combine them 0-first 1 second. From what I've found is that the layers after the first are less resolution though.

Upvotes: 2

Related Questions