TIFF is an absolutely huge specification with a phenominal numer of possible
combinations.
TIFF readers that choke on files are pretty bad beause they are supposed to
all fail gracefully if the file cannot be understood. There are bugs in much
of the code available these days however so one must be pragmatic.
The only work-around that I know of is to not load a file that the system
chokes on.
Have you tried using a tird-party library such as FreeImage for loading and
manipulating this TIFF image?
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
[quoted text, click to view] <realfnad@gmail.com> wrote in message
news:1143889492.862651.53670@j33g2000cwa.googlegroups.com...
> Hi all
>
> I've been pulling my hair out over this one all day.
>
> If I try and load a TIFF image that is missing PropertyItem 254, GDI+
> becomes very unstable. Generally these are 1bit PackBit compressed TIFF
> files. I've had crashes in Bitmap.New(myStream) at
> GdipImageForceValidation. I researched that one and found if I used
> Bitmap.FromStream and passed false for the 3rd parameter, I could coach
> it along a bit further (which, incidentally, sped up the code). Then I
> was having NullReferenceExceptions or InvalidOperation exceptions
> either when saving or disposing the image. As soon as GDI+ bit the
> bullet, it became very unstable and would generally crash when trying
> to do the next operation (read/save/dispose) and meant the program had
> to be restarted.
>
> I can probably contact the vendor who is handing us these tiff files
> and get them changed, so it's not a *major* catastrophe.
>
> Has anyone had any experience with TIFF files that GDI+ chokes on, and
> can they suggest any workarounds?
>
> Cheers in advance
> Dan
>