Hello, we have this exception:
InnerException = {“Index was outside the bounds of the array.”}
converting a jpg file to a png or to a pdf
sample4_l.jpg (346.8 KB)
Previous aspose libs did not have this problem
This is our code (never changed):
m_oDocument = Aspose.Imaging.Image.Load(_oInputStream);
m_iPageCount = 1;
//resize
if (((Aspose.Imaging.Image)m_oDocument).Width > ((Aspose.Imaging.Image)m_oDocument).Height)
{
if (((Aspose.Imaging.Image)m_oDocument).Width > 1024)
{
int iWidth = 1024;
int iHeight = (int)((1024.0f / (float)((Aspose.Imaging.Image)m_oDocument).Width) * (float)((Aspose.Imaging.Image)m_oDocument).Height);
((Aspose.Imaging.Image)m_oDocument).Resize(iWidth, iHeight, Aspose.Imaging.ResizeType.NearestNeighbourResample);
}
}
else
{
if (((Aspose.Imaging.Image)m_oDocument).Height > 1024)
{
int iHeight = 1024;
int iWidth = (int)((1024.0f / (float)((Aspose.Imaging.Image)m_oDocument).Height) * (float)((Aspose.Imaging.Image)m_oDocument).Width);
((Aspose.Imaging.Image)m_oDocument).Resize(iWidth, iHeight, Aspose.Imaging.ResizeType.NearestNeighbourResample);
}
}
Aspose.Imaging.ImageOptions.PngOptions OptionsIM = new Aspose.Imaging.ImageOptions.PngOptions();
OptionsIM.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha;
//OptionsIM.TransparentColor = new Aspose.Imaging.TransparentColorSetting(Aspose.Imaging.Color.Transparent);
Aspose.Imaging.ResolutionSetting oResIM = new Aspose.Imaging.ResolutionSetting(Convert.ToDouble(120), Convert.ToDouble(120));
OptionsIM.ResolutionSettings = oResIM;
((Aspose.Imaging.Image)m_oDocument).Save(_oOutputStream, OptionsIM);