Page 2 of 2

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-24T13:41:03-07:00
by pictogram
Wow 4mins. is way to long for what i need to do with this.
So what options do i may have to reduce this time dramatically?
Is the compression or the internal data structure (tiled,strips, or whatever) critical?

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-24T14:56:17-07:00
by fmw42
If your version of IM is still at 6.3.7 per your earlier message, then perhaps you really need to upgrade. You are over 200 versions behind.

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-24T15:02:31-07:00
by snibgo
It was faster for me under Windows than Ubuntu. Oddly, the G4 version was quicker than uncompressed.

I would expect Q8 to be quicker than Q16. If you can chop up the file before IM sees it, that might help.

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-24T16:57:44-07:00
by pictogram
fmw42 wrote:If your version of IM is still at 6.3.7 per your earlier message, then perhaps you really need to upgrade. You are over 200 versions behind.
Well i guess you're right. But there is no more recent version available, so i think i had to compile it from source... if no one knows a repository holding a backport of 6.6 on Lenny.

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-24T17:14:23-07:00
by fmw42
FYI:

recent versions of IM are multiprocessor compatible. so if you have dual core or more then you should see speedups with OpenMP enabled (by default)

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-25T00:39:47-07:00
by pictogram
I'm one step further. After compiling a current version from source, it works!
On my 3.4ghz Xeon it takes about 4 minutes (like stated before) to create the preview.
Even the preview contains a big black area (something is wrong), it is faaar to slow.

So, what can i do to find the source of this slowness and may speed things up.
It must not take more than 10 or 20 seconds.

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-25T02:41:01-07:00
by snibgo
Q8 might double the speed.

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-25T09:22:47-07:00
by fmw42
On some machines with multiple processors it actually runs slower with OpenMP enable than without. You might try disabling OpenMP if you have multiple processors and see if that helps.

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-10-20T13:58:42-07:00
by danbaatar
I am trying to do this same thing, but I cannot get ImageMagick to output a grayscale tiff. I've tried -type Grayscale and -colorspace Gray, and the output is always a bi-level image. Could there be something I'm doing wrong?

I've tried to explicitly set the depth, and I get this output:

Code: Select all

$ ./convert page_1_subsampled.tiff -depth 8 -colorspace Gray page_1_grayscale.tiff
lt-convert: Bits/sample must be 1 for Group 3/4 encoding/decoding. `page_1_grayscale.tiff' @ error/tiff.c/TIFFErrors/494.
Version: ImageMagick 6.6.5-1 2010-10-20 Q16
also tried ImageMagick 6.5.7-8 2009-11-26 Q16 on Ubuntu

Thanks in advance,
dan

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-10-20T14:07:10-07:00
by fmw42
If you tiff is binary then you may not be able to get it to grayscale depending upon the compression in the file unless you change the compression. You can try adding -type grayscale.

You might post a link to your tiff file so others can examine it. (or at least post result from:

identify -verbose page_1_subsampled.tiff

also see http://www.imagemagick.org/Usage/formats/#tiff

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-10-20T14:48:52-07:00
by danbaatar
I have tried -type grayscale, but it gives me the same results. Changing the compression would be fine with me, but I haven't seen how to specify the compression on the output tiff.

Here is a link to my test tiff:
http://www.danandchoka.net/page_1.tiff

Thanks again,
dan

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-10-20T15:00:08-07:00
by danbaatar
Ah, never mind. I see that the link you sent talks about how to change the compression level. Just in case anyone else runs across this in the future, the command that works for me is:

Code: Select all

$ ./convert page_1_subsampled.tiff -compress lzw -depth 8 -colorspace Gray page_1_grayscale.tiff
For some reason, if I don't specify depth it still doesn't change from bilevel.

Thanks a ton for taking the time to help!

--dan

Re: How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2011-07-27T00:59:53-07:00
by pictogram
I've ended up with the fact that IM is not able to handle Group4-Compressed Bilevel files of that size. Or, to be more gently, it makes no sense to do it with IM.

I finally found a suiteable tool called thumbnail (bundled for Debian in "libtiff-tools") which uses the libtiff, a specialized library for TIFF file handling.
Making thumbs of an arbitrary size takes only seconds without consuming any noticeable memory.