We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PNG color image to JPEG, purple background

Hi,

I’m using latest version of Aspose.Imaging (18.3.0)

When converting Png color images to Jpg images (using the following code),
I get a JPEG image with purple background.

var currentpath = @“path”;
using (var ImageA = Aspose.Imaging.Image.Load(currentpath + “picture.png”))
{
var JpegOpt = new JpegOptions();
JpegOpt.ColorType = JpegCompressionColorMode.Rgb;
JpegOpt.Quality = 60;
JpegOpt.CompressionType = JpegCompressionMode.Baseline;
JpegOpt.Jfif = new JFIFData()
{
DensityUnits = JfifDensityUnits.PixelsPerInch,
XDensity = 300,
YDensity = 300
};
ImageA.Save(currentpath + “picture.jpeg”, JpegOpt);
}

I also noticed two more suspicious facts :

  • if I don’t instanciate the JFIFData object, the JPEG image color is good (no purple)
  • if I use the YCbCr color mode, the JPEG image color is good (no purple)

Thanks.
Regards
Thomas N.

@ThomasNk,

I have observed your comments. Can you please share source files along with generated result so that we may further investigate to help you out.

picture.jpeg (752.7 KB)
picture.jpg (584.8 KB)

Hi,
I attached the source files, before (.Jpeg) and after (.png).

Thinks
Thomas N.

@ThomasNk,

I have worked with the source file shared by you and have been able to observe the issue. An issue with ID IMAGINGNET-2945 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed. We will share good news with you soon. I also suggest you for time being you may save image without setting JpegOpt.Jfif property.

The issues you have found earlier (filed as IMAGINGNET-2945) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz