Save to Tiff with JPEG compression

Hi,
I have a tiff image that I wish to save as a tiff with JPEG compression.
I don’t see that option under the TiffExpectedFormat enum and the options.

my code looks like this:

using (var image = Aspose.Imaging.Image.Load(memoryStreamIn))
{
ImageOptionsBase options = new TiffOptions(TiffExpectedFormat.@@what should I choose here??@@);
image.Save(memoryStreamOut, options);
}
is the Tiff with JPEG compression supported?
my Tiff is a scanned grayscale image of a doc. If JPEG is not supported, what would be the best choice for compression?
Hi Oren,

Thank you for your inquiry.

Please note that you may set compression mode by using the Compression property of the TiffOptions class. Your code will look like as follows:

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"C:\temp\testimaging.tiff"))
{
Aspose.Imaging.ImageOptions.TiffOptions saveOptions =
new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffJpegRGB);

//Set Compression mode
saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
image.Save(@"C:\temp\output.tiff", saveOptions);
}

For more information on TIFF compression and TIFF configuration visit the following URLs:



Hope the above helps. Feel free to contact us in case you have further comments or queries.

Hi Ikram,
I am trying this on a given tiff. I want to convert it from tiff+Old Jpeg Compression to tiff+new Jpeg Compression.
In one case, the source size was 15kb.
The destination comes out without any compression, so it’s size was 114kb.


when I right click on the image and look at the properties I see that the source is compressed with JPEG, and the dest has no compression.

LZW or any other non-destructive compression doesn’t work well in this case. I need the dest to be compressed with JPEG or similar compression.

here is my code:

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@“C:\temp\testimaging.tiff”))
{
Aspose.Imaging.ImageOptions.TiffOptions saveOptions =
new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffJpegRGB);

//Set Compression mode
saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Jpeg;
image.Save(@“C:\temp\output.tiff”, saveOptions);
}

Attached are the source and output files.
Hi Oren,

Thank you for your providing sample.

We have evaluated the scenario at our end and able to recreate the issue. The issue has been logged into our issue tacking system with ID IMAGING-35066. Our product team will further look into it. We will update you accordingly.

The issues you have found earlier (filed as IMAGING-35066) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.