Losing Color During Image Conversion Using Java Advanced Imaging

Hi Everyone,

I’m having trouble with my image conversion (Tiff to JPEG). I talked to some designers at my company, and I seem to be “oversaturating” the image, and I’m just using the default converters in Aspose. Here’s my code for reference:

static public void main(String[] args) throws Exception
{
File temp_root = new File(“c:/temp”);

String file_name = “17501-25-T007-527-OPEN.tif”;

TiffImage image = (TiffImage) Image.load(temp_root.toString() + “/ashley_hires/” + file_name);

JpegOptions jpg_options = new JpegOptions();

image.save(temp_root.toString() + “/after_aspose_conversion.jpg”, jpg_options);
}

Like I said, it just uses defaults. Does anyone know how to lower the saturation levels during image conversions? I’m including some crops of the image showing before and after:

before:
http:// s1298.photobucket.com/user/salmontres/media/before_conversion_zps6e82b192.jpg.html

after:
http:// s1298.photobucket.com/user/salmontres/media/after_aspose_conversion_zps47be6c0d.jpg.html

Hi Salvador,


Thank you for contacting Aspose support.

The presented problem seems to be an issue of the Aspose.Imaging for Java API because with the default settings the API should output the Jpeg image with same colors as of the source Tiff. Please provide the source file so we may further investigate the problem cause, and find a possible solution for this scenario.


Hi Babar,

Thank you for your quick reply. I’m including an image of an original close up image of a table top. I’m also including a link of a JPEG using the Aspose converter. Notice the green tint that seems to be around the image. I included the code in the previous post.

Please let me know if you come up with anything, and thank you!

http:// s1298.photobucket.com/user/salmontres/media/out_zps8b2d82d1.jpg.html?sort=3&o=1

Hi Salvador,


Thank you for the sample image. I have tested the case with your provided TIFF image however, the difference in the color is not too much obvious with this sample. The image in our original post clearly shows that the colors have been altered during the conversion process. Could you please provide the same sample (from your original post) for further investigation and correction purposes?

Please note, I have tried this case with a few other TIFF images as well but none of those samples allowed me to replicate the color change as shown here.

Thank you for your work Babar! Your conversion looks much better than mine, and if possible, I’d like to see the code you used. I uploaded the original image to DropBox, and I’m including the link below.

Please let me know what you come up with. Also, I don’t have to convert to JPEG. If I can convert to PNG and maintain the color while shrinking the overall size of the image, that would be okay too.


Like I mentioned in the previous post, if you can show me which classes you used to configure the sample output you attached, that would be really appreciated.

Hi Salvador,


I have used the following code snippet for the conversion. Moreover, I am using the latest version of Aspose.Imaging for Java 2.4.0 against JRE6 to evaluate this scenario.

Java

TiffImage image = (TiffImage)Image.load(sourceFile);
image.save(outputFile, new JpegOptions());

Hi again,


Please find the attachment for the comparison of the original Tiff image with Aspose.Imaging’s converted Jpeg. You will notice that the both images have the same colors. If you are not getting the similar results on your end then please upgrade the API to the latest version. In case you are already using the v2.4.0 of Aspose.Imaging for Java then please share environment details for further investigation.

Great work Babar! The only difference in our environment seems to be that I’m using Java 7. I’ll try switching to Java 6 to see if that yields any improvements, as your image conversions are much better than mine.

My apologies Babar, although the images look close to each other, they don’t look like the original. I think whatever program you used to open the original tiff is giving it a green hue. If you open the tiff image with a program like Windows Preview or something similar, you’ll see that the original tiff doesn’t contain that green hue, particularly apparent against the wall in the background.

Please let me know if this makes sense, or if I could elaborate on some points.

Hi Salvador,


Thank you for pointing this out. I have compared the two images in Windows Photo Viewer, the difference in the colors have now became apparent. Attached is the comparison snapshot for your reference. I have logged this incident in our bug tracking system under the ticket IMAGING-34590 for further investigation. Please spare us little time to properly analyze the problem cause, and to provide the fix at earliest possible. In the meanwhile, we will keep you posted with updates in this regard.

Please note, previously I was comparing the images in IrfanView. For unknown reasons, the said application renders the resultant image differently thus the color difference was not too obvious.

Please accept our apologies for the inconvenience caused.

Thanks Babar. The reason why there are issues in rendering is because IrfanView is decoding the Tiff image to some standard format before rendering, whereas Photo Viewer does little processing.

Thank you for identifying the issue, and please let me know how it develops.

Hi Salvador,


Thank you for the information. The ticket attached to this thread is currently in analysis phase, and has been scheduled to be fixed with the upcoming release of Aspose.Imaging for .NET 2.8.0. As soon as we receive more updates in this regard, we will post here for your kind reference.

The issues you have found earlier (filed as IMAGING-34590) 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.