Resolution of an image conversion problem

I set up this page to keep track of the resolution of a problem I encountered a while ago. Look at the image below and you will see my problem.

Many people who hit this page from google were actually looking for the script that I used to recursively produce PNG files from a directory tree full of TIF files. Of course, this script can easily be modified to suit any other conversion. The icing on the cake is that this script spawns as many threads as there are processors. Here it is :

files=`find . -name '*.tif' -print | wc -l | tail -c 2 | head -c 1`
cpu=`grep processor /proc/cpuinfo | wc -l | tail -c 2 | head -c 1`
nnumber=`expr $files / $cpu`
find . -name '*.tif' -print | sed -e 's/ /\\ /g;s/(/\\(/g;s/)/\\)/g' | xargs -P $cpu -n $nnumber mogrify -format png

Hardcode $nnumber and you can easily take advantage of an OpenMosix cluster. For this kind of batch tasks, OpenMosix is wonderful.

Thanks to Glenn Randers-Pehrson and Bob Friesenhahn who helped me debug it on the magick-users list.

Now, let's get on with the actual problem.

Update 20011015 : This problem is currently on standby. I guess it is hardware, but it is definitely not memory. I'll look into it later. Tell me if it looks familiar to you.

Problem image

At first, I thought Convert (part of the Imagemagick suite) seemed to have a major problem when producing a PNG file. The resulting PNG file has severe damage, generally on the lower right side of the picture, covering anywhere from zero to 90% of the surface. The damage looks like a random noise pattern with a slight relation to the look of the source file.

But then it appeared to me that the problem might not have anything to do with Imagemagick : Gimp has exactly the same problem converting from those TIF files to PNG. Since Gimp and Imagemagick are two independant systems, I suspect there is something rotten about my TIF files. But on the other hand, producing JPEG files with the same method and the same source TIF files has been no problem with either Gimp or Convert.

The source TIF files are 48 bits RGB. They originate from negative film digitalized through a Nikon LS-30 slide scanner ran with Vuescan 7.0.15. They look perfectly fine to me, but maybe there is something wrong about them that I'm not capable of seeing.

So, to sum it up, it's either Vuescan producing crap TIF files or Gimp and imagemagick that have a problem producing proper PNG.

Look at the images to see what I'm talking about. For each image (the original TIF file, the PNG from Imagemagick and the PNG from Vuescan), there is the actual image and a smaller scaled and compressed JPG copy. Be aware that the original full size TIF weights 28MB and the PNGs 11MB. The downscaled JPEG preview versions weight around 100KB and should be more suitable for browsing.

Preview files :

  • Original TIF preview
  • Gimp PNG conversion preview
  • Imagemagick PNG conversion preview

    Full size files :

  • Original TIF
  • Gimp PNG conversion
  • Imagemagick PNG conversion

    Now, for even more fun : out of 152 pictures scanned so far, this affects only 73 pictures. The 81 others have converted just fine. And the erroneous data in the picture seems never to be exactly the same.

    Nice funky bug. I'm puzzled. Has anybody ever seen this kind of problem or has any idea what is hapenning ?

  • Imagemagick version : 5.3.7-1
  • Gimp version : 1.2.1-4
  • System : Linux 2.4.6 with Debian on a dual P3-750 with 512 MB RAM. My work partition is a RAID zero array made with two 4GB ultra-SCSI disks formatted with ReiserFS.

  • This is ruwenzori.net. Send comments, suggestions, criticism, money and death threats to Jean-Marc Liotier.