Hello,
I am using the Aspose.PDF version 7.7.0.0, Aspose.Cells version 7.4.1.0 and Aspose.Words version 13.2.0.0.
Problem:
I am trying to convert the PDF document to Tiff image.
The tiff Image that is produced has 32 bpp and Compresion LZW.
Because I need a grayscale tiff image to be produced.
I am using the following code snippet:
var tiffSettings=new TiffSettings();
tiffSettings.Compression= CompressionType.CCITT4;
tiffSettings.Depth= ColorDepth.Format1bpp;
But still the image that is produced with 32 bpp and Compression LZW.
I have attached the TIFF file(TIFF1.tif) that is produced from TIFF1.pdf(also attached)
How can I obtain the tiff image produced reduced to 1bpp but with 2200* 1700 resolution.
Please advice.
Thanks,
Jess
Hi Jess,
//open document<o:p></o:p>
Document pdfDocument = new Document("c:/TIFF1.PDF");
//create Resolution object
Resolution resolution = new Resolution(300);
resolution.X = 2200;
resolution.Y = 1700;
//create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.CCITT4;
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp;
tiffSettings.SkipBlankPages = false;
//create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
//convert a particular page and save the image to stream
tiffDevice.Process(pdfDocument, “c:/TIFF1_Converted.tif”);
// load TIFF image<o:p></o:p>
System.Drawing.Image image = System.Drawing.Image.FromFile("c:/pdftest/TIFF1_Converted.tif");
int compressionTagIndex = Array.IndexOf(image.PropertyIdList, 0x103);
System.Drawing.Imaging.PropertyItem compressionTag = image.PropertyItems[compressionTagIndex];
// detemine the compression type
Console.WriteLine("Compression type = "+ BitConverter.ToInt16(compressionTag.Value, 0));
// check the color depth information
Console.WriteLine("Color
Depth = "+ image.PixelFormat);
1: no compression
2: CCITT Group 3
3: Facsimile-compatible CCITT Group 3
4: CCITT Group 4 (T.6)
5: LZW
In console I am getting
- Compression type = 4
- Color Depth = Format1bppIndexed