Free Support Forum - aspose.com

Problem converting TIFF to JPG after upgrading Aspose library

I have just upgraded from Aspose Imaging version 17.12 to version 20.12 (Java version). I have a unit test that is now failing which is converting a multi-page tiff image to JPG. The exception being thrown is
class com.aspose.imaging.internal.Exceptions.NotImplementedException: Cannot perform conversion from RgbIndexed1Bpp, used channels: 1 to YCbCr, used channels: 8,8,8 format
What has changed in the API to break this test? I have attached a snippet of the code that used to work and is now failing here

    List<byte[]> originalJpegs = new ArrayList<>();
    ByteArrayInputStream bais = new ByteArrayInputStream( originalTiffImage );
    TiffImage tiffImage = (TiffImage) TiffImage.load( bais );
    for ( TiffFrame frame : tiffImage.getFrames() )
    {
        JpegImage jImage = new JpegImage( frame );
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        jImage.save( baos );
        jImage.dispose();
        byte[] jImageBytes = baos.toByteArray();
        originalJpegs.add( jImageBytes );
    }
    tiffImage.dispose();

Thanks

@PhilF

Can you please share the source file that is reproducing the issue on your end. Please also try using latest Aspose.Imaging for .NET 21.2 as well before sharing information with us.

I have already attached the source code that is causing the problem in the original posting above. Also we don’t use .NET - we have the Java version of Aspose. Version 20.12 is the latest version of the Java imaging library - there is no 21.2 version. (Note I do have the 21.2 version of Aspose Total, but that only includes version 20.12 of the Imaging library and that is what we are using).

@PhilF

Thank you for the clarification. I requested for the image source file that is reproducing issue on your end and that I may use on my end to serve purpose.

multiPage.zip (62.1 KB)
Thanks. I have uploaded a copy of the test image we are using here. It’s been zipped up as the upload didn’t allow me to attach a tiff file.

@PhilF

I have created a ticket with ID IMAGINGJAVA-2054 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 notified once the issue will be fixed.

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