467,075 Members | 1,006 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,075 developers. It's quick & easy.

Tiff size when generated n code.

We are scanning images and saving them as TIFF's in a database. We are
running into some problems because in the creation of the TIFF the
EncoderValue.CompressionLZW is ignored. It does not seem to do anything with
the compression parameter and image size ends up being enormous. An image is
4000kb when creating the TIFF in code compared to 300kb when the scanner
saves the image directly to the hard drive.

As a result our database is growing incredibly large and at a much faster
rate than we planned - we are at over 100 gig after a year.

Does anyone have any suggestions for a better TIFF library of better way to
generate TIFF in code?

Thanks!
Current code snippet (not complete):

//the first item in the list is the master frame.
masterBitmap = this.imageContainer[0] as Bitmap;

//save the first item
ImageCodecInfo imageCodecInfo = this.GetTiffCodec();
encoderParameters.Param[0] = new EncoderParameter(Encoder.SaveFlag,
EncoderValue.MultiFrame);
encoderParameters.Param[1] = new EncoderParameter(Encoder.Compression,
(long)EncoderValue.CompressionLZW);

masterBitmap.Save(memoryStreamImage, imageCodecInfo, encoderParameters);

//add all images from index 1 to n
encoderParameters.Param[0] = new EncoderParameter(Encoder.SaveFlag,
EncoderValue.FrameDimensionPage);
encoderParameters.Param[1] = new EncoderParameter( Encoder.Compression,
(long)EncoderValue.CompressionLZW);
Bitmap image = null;
for (int i = 1; i < this.imageContainer.Count; i++)
{
image = this.imageContainer[i] as Bitmap;
masterBitmap.SaveAdd(image, encoderParameters);
}

//close out the file.
encoderParameters.Param[0] = this.GetEncoderParameter(EncoderValue.Flush);
masterBitmap.SaveAdd(encoderParameters);

Nov 15 '06 #1
  • viewed: 1156
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Nicolas Guilhot | last post: by
1 post views Thread by Maurice Mertens | last post: by
1 post views Thread by Prasad More | last post: by
6 posts views Thread by qysbc | last post: by
1 post views Thread by amit gupta | last post: by
1 post views Thread by Stedak | last post: by
reply views Thread by wbsmith@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.