tags:

views:

483

answers:

2

My program, that converts a multi page TIFF to PDF is not longer working under Windows 7. The program contains code that walks through the pages of the TIFF, converts each page as TIFF with CCITT Group4 compression and inserts the bitmap data in the resulting PDF file.

Converting is done in the following way (c#):

 ImageCodecInfo tiffCodecInfo = GetEncoderInfo("image/tiff");
 EncoderParameters myEncoderParameters = new EncoderParameters(2);

 // Save the bitmap as a TIFF file with CCITT group4 compression.    
 myEncoderParameters.Param[0] = new EncoderParameter System.Drawing.Imaging.Encoder.Compression, (long)EncoderValue..CompressionCCITT4);
 myEncoderParameters.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.ColorDepth, 1L);
 image.Save(source, tiffCodecInfo, myEncoderParameters);

It seems that the behaviour of GDI+ is changed in Windows 7: The resulting CCITT bitmap data is no longer encoded in a single strip. Because of this I cannot use this bitmap data in my PDF file.

Question: does anybody know how I can tell GDI+ to encode the bitmap data in a single strip?

+1  A: 

I received an answer from Microsoft:

Yes, in Windows 7 we did extensive work to the TIFF CODEC. One of the pieces of work was to support decoding and encoding in multiple strips. Unfortunately there is no way to control the number of strips outputted by the encoder.

Corne
Doen anybody by a chance know how to convert multi strip CCITT G4 data to a single strip?
Corne
I don't know anything about GDI+, but I've written C code which can do what you need. It will convert the multi-strip G4 image into a compact run-length encoded format and then re-encode it as G4 in a single strip.Let me know if I can [email protected]
BitBank
+1  A: 

http://bitmiracle.com/libtiff/

See also: http://stackoverflow.com/questions/2041783/using-libtiff-from-c-to-access-tiled-tiff-images

rwong
LibTiff 2.0 (just released) ships with samples and one of them shows how to convert any non-tiled TIFF image to the TIFF image which have all data written in a single strip.
Bobrovsky