S
SF
Folks,
I've been running into problems with a multipage Tif viewer that I wrote to
display fax images in an ASP.Net app. I've been basically following the
standard examples on how to do this:
- Read the image from a file
- set the current frame
- write the frame data to an output stream
and ended up with this code:
<snip>
System.Drawing.Image b;
System.Drawing.Imaging.FrameDimension frameDim;
//Read Tif from file (todo: change fromFile to stream)
strFilename = ConfigurationSettings.AppSettings["Images.Dir"] +
Request["filename"];
b = System.Drawing.Image.FromFile(strFilename);
//Set current frame
frameDim = new
System.Drawing.Imaging.FrameDimension(b.FrameDimensionsList[0]);
int intFrame = int.Parse(Request["frame"]);
b.SelectActiveFrame(frameDim,intFrame);
//Save to output stream in jpg format
Response.ContentType="image/jpeg";
b.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
b.Dispose();
</snip>
Now, this code works fine with Group 4 Tiff files. However, I am dealing
with Group 3 and here the application throws a "A generic error occurred in
GDI+."-exception whenever intFrame>0 (basically I can view the first page
and that's it). I saw other people in newsgroups having the same kind of
roblem but it never got resolved. Is this a bug in System.Drawing.Image? Is
there a patch or workaround for this?
Any advice/suggestions/code samples greatly appreciated.
Thanks
-Stefan
PS: If needed, I can supply an example Tif for both Group3/Group4 formats.
I've been running into problems with a multipage Tif viewer that I wrote to
display fax images in an ASP.Net app. I've been basically following the
standard examples on how to do this:
- Read the image from a file
- set the current frame
- write the frame data to an output stream
and ended up with this code:
<snip>
System.Drawing.Image b;
System.Drawing.Imaging.FrameDimension frameDim;
//Read Tif from file (todo: change fromFile to stream)
strFilename = ConfigurationSettings.AppSettings["Images.Dir"] +
Request["filename"];
b = System.Drawing.Image.FromFile(strFilename);
//Set current frame
frameDim = new
System.Drawing.Imaging.FrameDimension(b.FrameDimensionsList[0]);
int intFrame = int.Parse(Request["frame"]);
b.SelectActiveFrame(frameDim,intFrame);
//Save to output stream in jpg format
Response.ContentType="image/jpeg";
b.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
b.Dispose();
</snip>
Now, this code works fine with Group 4 Tiff files. However, I am dealing
with Group 3 and here the application throws a "A generic error occurred in
GDI+."-exception whenever intFrame>0 (basically I can view the first page
and that's it). I saw other people in newsgroups having the same kind of
roblem but it never got resolved. Is this a bug in System.Drawing.Image? Is
there a patch or workaround for this?
Any advice/suggestions/code samples greatly appreciated.
Thanks
-Stefan
PS: If needed, I can supply an example Tif for both Group3/Group4 formats.