HighTechTalks DotNet Forums  

TIFF image not displaying correctly

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss TIFF image not displaying correctly in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Kyle M. Burns
 
Posts: n/a

Default TIFF image not displaying correctly - 11-14-2007 , 10:39 AM






I'm using the System.Drawing.Imaging namespace to create multi-page TIFFs.
Some of the frames are pulled from existing JPEG files and some are
dynamically created by my application using the following process:

1) Create a new bitmap, specifying size
2) Obtain the graphics object for the bitmap
3) call the Clear method of the graphics, passing Color.White
4) repeatedly call DrawString on the Graphics object
5) Save the image to a MemoryStream

When persisting bitmaps to the stream, I'm using the Tiff ImageCodecInfo and
passing a single EncoderParameter with Encoder.SaveFlag and
EncoderValue.MultiFrame.

The resulting TIFF image can be viewed just fine with the Microsoft Windows
Picture and Fax Viewer, but when I open it either in Microsoft Office
Document Imaging or MSPaint, all I see are black pages. Does anyone know
what causes this and how I may work around it?

Reply With Quote
  #2  
Old   
Kyle M. Burns
 
Posts: n/a

Default RE: TIFF image not displaying correctly - 11-14-2007 , 11:48 AM






I found the solution. Just in case anyone else runs into this, here is the
solution:

The default PixelFormat of the bitmap included an alpha channel, which
appears to be ignored by the Windows Picture and Fax Viewer. When I changed
to an RGB pixel format that does not include an alpha channel, I was able to
view the image in Windows Picture and Fax Viewer, Microsoft Document Imaging,
and MSPaint with no problem.

"Kyle M. Burns" wrote:

Quote:
I'm using the System.Drawing.Imaging namespace to create multi-page TIFFs.
Some of the frames are pulled from existing JPEG files and some are
dynamically created by my application using the following process:

1) Create a new bitmap, specifying size
2) Obtain the graphics object for the bitmap
3) call the Clear method of the graphics, passing Color.White
4) repeatedly call DrawString on the Graphics object
5) Save the image to a MemoryStream

When persisting bitmaps to the stream, I'm using the Tiff ImageCodecInfo and
passing a single EncoderParameter with Encoder.SaveFlag and
EncoderValue.MultiFrame.

The resulting TIFF image can be viewed just fine with the Microsoft Windows
Picture and Fax Viewer, but when I open it either in Microsoft Office
Document Imaging or MSPaint, all I see are black pages. Does anyone know
what causes this and how I may work around it?

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.