Free Support Forum - aspose.com

Exception converting jpg file

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);

@BooleServer,

I have worked with the image shared by you and have been able to observe the issue. An issue with ID IMAGINGNET-2991 has been created in our issue tracking system to investigate the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

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