Bad TIFF?

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?".
Post Reply
johnkarp

Bad TIFF?

Post by johnkarp »

I'm trying to look at the full output of GOES weather satellites, presented in TIFF format, for example:

http://goes.gsfc.nasa.gov/goeseast/full ... G12I01.tif (74 MB)

The problem is that every image I look at is cut off; the bottom of every image is black. Since these files are unusually large (14400x12001) I wouldn't be surprised to see bugs popping up.

Can someone tell me whether these images are broken, or if its a ImageMagick/libtiff bug?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Bad TIFF?

Post by el_supremo »

I downloaded the image, viewed the original with PSP X and then used ImageMagick 6.3.5 to resize it down to 10% of its original size with no problems.

Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bad TIFF?

Post by magick »

We resized and displayed the TIFF image without any problems. We're using ImageMagick 6.3.5-6.
johnkarp

Re: Bad TIFF?

Post by johnkarp »

I'm using 6.3.5-6.

In particular:

Code: Select all

convert 0708281445G12I01.tif -resize 640x640 foo.png
produces an image where the bottom 3/4ths is blackened out.

The file opens properly in the gimp (although it takes a while).
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bad TIFF?

Post by magick »

You could be running out of temporary space. Set the MAGICK_TMPDIR environment variable to a path that has several gigabytes of free space. Also add -limit area 1 to your command line to force the conversion to disk rather than anonymous memory mapped I/O.
johnkarp

Re: Bad TIFF?

Post by johnkarp »

Okay, that fixes it. Thank you.

(Shouldn't ImageMagick complain if it is forced to lose image data due to a memory shortage? Failing silently is bad behavior, IMO)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bad TIFF?

Post by magick »

What OS are you using? When a memory map request fails, the system should generate a SIGBUS signal. It does for us under Fedora Core Linux.
johnkarp

Re: Bad TIFF?

Post by johnkarp »

Gentoo.

Linux bouzouki 2.6.20.6 #1 Mon Apr 9 17:05:50 CDT 2007 i686 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
gcc 4.1.2
glibc 2.5

Code: Select all

convert 0708281445G12I01.png -trim 0708281445G12I01.trim.png
gets a sigbus. valgrind output:

Code: Select all

==8224== Warning: set address range perms: large range 1030586368 (defined)
==8224==
==8224== Process terminating with default action of signal 7 (SIGBUS)
==8224==  Non-existent physical address at address 0x73FC7FFF
==8224==    at 0x4023347: memcpy (mc_replace_strmem.c:406)
==8224==    by 0x41055BA: CopyMagickMemory (in /usr/lib/libMagick.so.10.0.8)
==8224==    by 0x40697F1: ClonePixelCache (in /usr/lib/libMagick.so.10.0.8)
==8224==    by 0x406C99B: SetCacheNexus (in /usr/lib/libMagick.so.10.0.8)
==8224==    by 0x406CBF0: SetPixelCache (in /usr/lib/libMagick.so.10.0.8)
==8224==    by 0x4064AD2: SetImagePixels (in /usr/lib/libMagick.so.10.0.8)
==8224==    by 0x40F2E52: CloneImage (in /usr/lib/libMagick.so.10.0.8)
==8224==    by 0x415F06E: CropImage (in /usr/lib/libMagick.so.10.0.8)
==8224==    by 0x415F5A5: TrimImage (in /usr/lib/libMagick.so.10.0.8)
==8224==    by 0x42AAEB2: MogrifyImage (in /usr/lib/libWand.so.10.0.8)
==8224==    by 0x42AB732: MogrifyImages (in /usr/lib/libWand.so.10.0.8)
==8224==    by 0x425AF07: ConvertImageCommand (in /usr/lib/libWand.so.10.0.8)
There is apparently no signal handler set for SIGBUS. Which is better than silent failure, but I think it would be best if the signal were caught and an actual error message printed.
Post Reply