How to convert TIFFG4 compressed 1-bit bilevel to gray

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

How to convert TIFFG4 compressed 1-bit bilevel to gray

Post 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'.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

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

Post 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).
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

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

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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 ...
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

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

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 »

withdrawn -- sorry -- response to wrong topic
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

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

Post 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.
Post Reply