Page 1 of 1
Converting LZW Compressed TIFFs on Debian
Posted: 2016-04-16T05:42:13-07:00
by felix
Hey I am using:
Version: ImageMagick 6.9.3-8 Q16 x86_64 2016-04-16
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License:
http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): bzlib freetype gvc jbig jng jpeg lzma png tiff wmf x zlib
and have the problem that TIFF pictures with LZW compression which are being converted to JPG are resulting in such images:
http://postimg.org/image/iv8tffd57/
with grey grain on it and distortion ... TIFF images without any compression are working just fine, as well as JPG etc. (I am using paperclip gem for rails to upload and convert stuff)
I would really appreciate if someone could give me a hint why especially LZW compressed TIFFs are failing .. am I missing a certain configure option when building from source or maybe some library? Everything runs on a debian distribution.
Thank you in advance and best regards
Felix
Re: Converting LZW Compressed TIFFs on Debian
Posted: 2016-04-16T05:51:00-07:00
by snibgo
Please post the input tiff file that gave that output.
Re: Converting LZW Compressed TIFFs on Debian
Posted: 2016-04-16T07:52:28-07:00
by felix
Thank you for your reply. You can find a file which is affected as well here:
http://www.file-upload.net/download-114 ... y.tif.html
The result after Uploading and converting to JPG looks like this:
http://postimg.org/image/5j408hz8z/
So I think it is not a particular file but the LZW compression because saving the file as none compressed and uploading will produce a correct result. Only those with LZW are getting these fragments..
Thank you once again!
Re: Converting LZW Compressed TIFFs on Debian
Posted: 2016-04-16T08:12:57-07:00
by snibgo
That image converts for me with no problem on Windows 8.1, using v6.9.2-5 (pre-built binary) and v6.9.3-7 (built from source with Cygwin).
Did you build IM yourself? Perhaps one of your delegates is out of date.
For my two versions, "convert -list format" shows:
Code: Select all
TIFF* rw+ Tagged Image File Format (LIBTIFF, Version 4.0.6)
TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.3)
Re: Converting LZW Compressed TIFFs on Debian
Posted: 2016-04-16T09:25:52-07:00
by felix
Code: Select all
TIFF* rw+ Tagged Image File Format (LIBTIFF, Version 4.0.3)
TIFF64* rw- Tagged Image File Format (64-bit) (LIBTIFF, Version 4.0.3)
I have Version 4.0.3 instead of 4.0.6 of LIBTIFF ... Do you think that could be a reason? How can I upgrade LIBTIFF?
Best
Felix
Re: Converting LZW Compressed TIFFs on Debian
Posted: 2016-04-16T09:49:57-07:00
by snibgo
As I said, one of my working versions uses libtiff 4.0.3, so I don't suppose that is the problem.
What happens if you convert an image to LZW, eg:
Code: Select all
convert rose: -compress LZW rose_lzw.tiff
Does that work? Can you convert it back?
I've uploaded LZW-compressed files, from IM v6.9.2-5. Can you read them?
http://snibgo.com/imforums/rose_lzw.miff
http://snibgo.com/imforums/rose_lzw.tiff
Sorry, I'm just guessing.
Re: Converting LZW Compressed TIFFs on Debian
Posted: 2016-04-17T00:27:27-07:00
by felix
I solved the issue by removing the "original" property in the paperclip configurations:
Code: Select all
has_attached_file :image,
styles: { [i][b]original: ["100%"][/b][/i], small: ["580x", :jpg] },
It would produce this convert log:
Code: Select all
Command :: file -b --mime '/tmp/db4eb01d3eef81839d75de9ed28b5c5b20160417-32710-15drzvq.tiff'
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/db4eb01d3eef81839d75de9ed28b5c5b20160417-32710-1iy2b1l.tiff[0]' 2>/dev/null
Command :: identify -format %m '/tmp/db4eb01d3eef81839d75de9ed28b5c5b20160417-32710-1iy2b1l.tiff[0]'
Command :: convert '/tmp/db4eb01d3eef81839d75de9ed28b5c5b20160417-32710-1iy2b1l.tiff[0]' -auto-orient -resize "100%" '/tmp/db4eb01d3eef81839d75de9ed28b5c5b20160417-32710-1iy2b1l20160417-32710-1mbj02m'
Command :: file -b --mime '/tmp/db4eb01d3eef81839d75de9ed28b5c5b20160417-32710-1iy2b1l20160417-32710-1mbj02m'
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/8a84481945df3b81940e5da8b2e0d89a20160417-32710-72gjjt[0]' 2>/dev/null
Command :: convert '/tmp/8a84481945df3b81940e5da8b2e0d89a20160417-32710-72gjjt[0]' -auto-orient -resize "580" '/tmp/8a84481945df3b81940e5da8b2e0d89a20160417-32710-72gjjt20160417-32710-1vmh3tk.jpg'
Command :: file -b --mime '/tmp/8a84481945df3b81940e5da8b2e0d89a20160417-32710-72gjjt20160417-32710-1vmh3tk.jpg'
2016-04-17T06:15:43.564Z 32710 TID-ymh7k PageKrpanoWorker JID-0e824adf4591dde1176a2335:1 INFO: start
Some How the -auto-orient -resize "100%" in this procedure would not work on LZW compressed images .. I could not reproduce it manually but this fixed it..