[Mono-list] corrupted tiff file on ppc

Dan Shryock dan.shryock at gmail.com
Fri Nov 14 19:30:01 EST 2008


Does anybody have any ideas why a simple jpg to tiff conversion leads
to a corrupted tiff file on OSX 10.4 PPC?

I'm using the following code:

using System;
using System.Drawing;
using System.Drawing.Imaging;
public class Test{
	public static void Main(string[] args){
		using(var photo = new Bitmap(args[0])){
			using(var output = new FileStream(args[0]+".tiff", FileMode.Create)){
				output.SetLength(0);
				photo.Save(output,ImageFormat.Tiff);
			}
		}
	}
}

The resulting tiff file is unreadable when produced by mono 2.0.1 on
osx, and works just fine using mono 1.9.1 on linux.

When I compare the two files using "cmp -l good.tiff bad.tiff" the
output I receive is:
      1 111 115
      2 111 115
      3  52   0
      4   0  52
      5  10   0
      6 300   0
      7  22   0
     19  20 377
   2579  30 377
   5139  43 377
   7699  51 377
  10259  47 377
  12819  43 377
  15379  43 377
  17939  46 377
  20499   0 377
  23059 120 377
  25619 117 377
  28179  50 377
  30739  63 377
  33299  37 377
  35859   3 377
  38419  44 377
<<snip>>


The interesting thing is that after the first 7 bytes, the bad value
is always listed as 377, and the offset between bad bytes is 2560.

So this seems like a bug in mono, but I wanted to ask just to make
sure that I'm not doing anything stupid.  Thanks!

Dan


More information about the Mono-list mailing list