When I convert any file type to a jpeg using Progressive Compression and RGB or Grayscale I encounter the following error:"Index was outside the bounds of the array."
Attached is source image.
Code:
using (var original = Image.Load(“ColorGif.gif”))
{
var jpegOptions = new JpegOptions()
{
ColorType = JpegCompressionColorMode.Grayscale,
CompressionType = JpegCompressionMode.Progressive,
Quality = 90
};
original.Save(“result.jpg”, jpegOptions);
}
Hi Michael,
Thank you for contacting Aspose support.
We have evaluated your presented scenarios while using the latest version of Aspose.Imaging for .NET 2.6.0, and we are able to observe two different exceptions that we have logged in our bug tracking system for further investigation. The details of the exceptions and associated ticket numbers are as follow.
-
IMAGING-34468: ImageSaveException: “Index was outside the bounds of the array.”, while exporting GIF to JPEG with ColorType as RGB & CompressionType as Progressive.
-
IMAGING-34469: ImageSaveException: “The method or operation is not implemented.”, while exporting GIF to JPEG with ColorType as Grayscale & CompressionType as Progressive.
Please note, the ticket IMAGING-34469 has been logged as a “Feature Request” because it seems that the combination of ColorType as Grayscale & CompressionType as Progressive cannot be used with current implementation of Aspose.Imaging for .NET API. Please spare us little time to properly analyze the above mentioned scenario in detail. In the meanwhile, we will keep you posted with updates in this regard.
The issues you have found earlier (filed as IMAGING-34468) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
@MHohlios,
Please try using below sample code using Aspose.Imaging for .NET 17.11 on your end for shared requirement.
string sourcePath = @"c:\aspose.work\IMAGINGNET\1842\src.png";
string outputPath = @"c:\aspose.work\IMAGINGNET\1842\out.jpg";
JpegOptions jpegOptions = new JpegOptions()
{
ColorType = JpegCompressionColorMode.Grayscale,
CompressionType = JpegCompressionMode.Progressive,
Quality = 100, // make the output image bigger to observe progressive scanning :)
};
using (Image image = Image.Load(sourcePath))
{
image.Save(outputPath, jpegOptions);
}
The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.