Page 1 of 2

How to convert TIFFG4 compressed 1-bit bilevel to gray

Posted: 2010-03-23T14:45:53-07:00
by pictogram
Hello,

i have 1-Bit monochrome (bilevel) images having 17.300x27.051 pixels at 1.270dpi. They are TIFFG4 compressed.
Now i want to create previews from them, so i thought i can use IM to convert those files to a graylevel png or jpeg with a lower resolution (72 dpi) and size (10%).

This is how i try and what i get:

Code: Select all

convert source_image.tif -scale 10% -colorspace Gray preview_image.tif

convert: source_image.tif: unknown field with tag 32781 (0x800d) encountered. `TIFFReadDirectory'.
convert: unable to extend cache `source_image.tif': Invalid argument.
convert: missing an image filename `preview_image.tif'.

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

Posted: 2010-03-23T15:13:19-07:00
by fmw42
try -type grayscale rather the -colorspace gray. but perhaps you image is way to big for your memory. see http://www.imagemagick.org/Usage/files/#massive

what version of IM are you using? if old, try upgrading.

you seem to be getting a warning about some header filed in the tiff that it does not understand, but that should be OK as a warning.

I don't know if IM understands that type of Tiff. I am not an expert on that issue.

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

Posted: 2010-03-23T15:20:35-07:00
by pictogram
Still the same, an error occures. What can i do with these large files? Is there a way to get them smaller, consume less memory?
I've read about 'stream' but not shure how to use this.

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

Posted: 2010-03-23T15:25:06-07:00
by fmw42
for very large images, see http://www.imagemagick.org/Usage/files/#massive

also what version of IM and what platform? perhaps you also need to upgrade. But I am still not sure if IM understands that type of TIFF. It might. I just don't know as there are so many variants.

Can you try a smaller tiff and see if that works?

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

Posted: 2010-03-23T17:11:27-07:00
by snibgo
How much memory do you have? Try it with no other software running. Put it online, and someone with a larger machine might have a go at it.

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

Posted: 2010-03-24T00:39:01-07:00
by pictogram
Tried to convert with tiffcp into an uncompressed version, still the same.
It runs on Debian Linux machine having 512MB of physical RAM. IM version is 6.3.7 08/07/09 Q16 (from Lenny packages).
I used -debug and see it will try to create a 3.64gb tempfile, which is quite large, but even the disk space is available the cache returns an error.
#massive don't put me further. I still have problems understanding the syntax, too many variants... but i think the size is the problem.
Here is the TIFF as
compressed (G4) http://inet-sv1.kreisbote.de/downloads/ ... rge_g4.tif (~5MB)
and uncompressed http://inet-sv1.kreisbote.de/downloads/ ... /large.tif (~60MB).

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

Posted: 2010-03-24T04:36:36-07:00
by magick
The large_g4.tif file returned a 'invalid colormap index' exception. However your large.tif file converted without complaint with ImageMagick 6.6.0-8, the current release;
  • convert -limit area 0 large.tif -scale 10% -colorspace Gray preview_image.tif

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

Posted: 2010-03-24T05:11:37-07:00
by pictogram
Sounds good, but doing your command only shows

Code: Select all

convert: unable to extend cache `large.tif': Invalid argument.
convert: missing an image filename `preview_image.tif'.
Giving it -debug cache it shows

Code: Select all

2010-03-24T13:16:16+01:00 0:01 0.010u 6.3.7 Cache convert[2500]: cache.c/unknown/2162/Cache
  destroy
2010-03-24T13:16:16+01:00 0:01 0.010u 6.3.7 Cache convert[2500]: cache.c/unknown/2162/Cache
  destroy
2010-03-24T13:16:16+01:00 0:01 0.010u 6.3.7 Cache convert[2500]: cache.c/unknown/3438/Cache
  extend large.tif[0] (/files/admin/devel/imagemagick/magick-XX3E34VJ[4], disk, 3.48674gb)
2010-03-24T13:16:16+01:00 0:01 0.030u 6.3.7 Cache convert[2500]: cache.c/unknown/2162/Cache
  destroy large.tif[0]
The filesystem has about 40gig free.

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

Posted: 2010-03-24T06:44:53-07:00
by snibgo
On Windows 7, 4 GB RAM, IM 6.6.0-8:

Code: Select all

convert large_g4.tif -scale 10% -colorspace Gray preview.tif
convert large.tif -scale 10% -colorspace Gray preview2.tif
both worked fine, with the TIFFReadDirectory warning on the first file.

Each used 0.5GB of my memory, but your mileage will vary. I suggest you try the latest version of IM. If that doesn't work, get more RAM.

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

Posted: 2010-03-24T06:46:42-07:00
by magick
Find an area on your disk with lots of temporary disk space and point ImageMagick to it, like this:
  • export MAGICK_TMPDIR=/data/tmp
    convert -limit area 0 large.tif ...

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

Posted: 2010-03-24T07:26:09-07:00
by pictogram
I did, but did not tell you. The path in the above terminal-output points to a disk which has about 40gig free, which should be enough.
Why does it not convert on my Linux box?
I tried it on another host, the same result. Give the Linux host about 5GIG of RAM, nothing changes.

Please, all who can convert it, tell me how long it takes on your platform.

Any other hints about this issue?

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

Posted: 2010-03-24T08:10:05-07:00
by snibgo
About 4 minutes.

On my mid-range laptop, 2 x 2.1 GHz, under Windows 7, IM 6.6.0-8: disk IO was trivial and the CPUs weren't saturated, so I guess memory speed was the limiting factor.

The same machine under Ubuntu 9.10, a slightly older IM, has only 3GB available memory and used it all.

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

Posted: 2010-03-24T09:15:34-07:00
by magick
Which version of IM are you using? It seems to work ok with ImageMagick 6.6.0-8. Can you try that version? If not, add -debug cache to your command line post the output.

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

Posted: 2010-03-24T09:28:55-07:00
by fmw42
withdrawn -- sorry -- response to wrong topic

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

Posted: 2010-03-24T13:38:39-07:00
by pictogram
magick wrote:Which version of IM are you using? It seems to work ok with ImageMagick 6.6.0-8. Can you try that version? If not, add -debug cache to your command line post the output.
Did this already. Please look at the beginning of the thread.