Uncompressed tiff files not loading

Hi, I’ve tried everything including:

Image.load(“src/images/image.tif”);

and

(TiffImage) Image.load(“src/images/image.tif”)

but it doesn’t load uncompressed tif image files. The same code has worked successfully with jpgs, psds, bmp, LZW and ZIP compressed tif’s still nothing with uncompressed ones.

I need it to work with uncompressed ones, not only because performance but compatibility reasons as well so I would really appreciate any help on this as I bought the API Imaging specifically for this task.

Thanks,
Sebastian.

@sebastianzapata,

I have observed your comments. Please share sample code along with environment details and source files so that we may further investigate to help you out.

Hi Adnan,

Thank you, please find attached the console output along the source files:

cd C:\Users\Friendly Shade\Documents\NetBeansProjects\mavenproject1; “JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111” cmd /c “""C:\Program Files\NetBeans 8.2\java\maven\bin\mvn.bat" -Dexec.args="-classpath %classpath com.mycompany.mavenproject1.Main" -Dexec.executable="C:\Program Files\Java\jdk1.8.0_111\bin\java.exe" -Dmaven.ext.class.path="C:\Program Files\NetBeans 8.2\java\maven-nblib\netbeans-eventspy.jar" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec"”
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects…


Building mavenproject1 1.0-SNAPSHOT

— exec-maven-plugin:1.2.1:exec (default-cli) @ mavenproject1 —
License is Set!
Exception in thread “main” class com.aspose.imaging.coreexceptions.ImageLoadException: Image loading failed. —> class com.aspose.imaging.internal.ew.d: Profiles are not supported
com.aspose.imaging.fileformats.dng.DngImage.a(Unknown Source)
com.aspose.imaging.internal.loaders.DngLoader.load(Unknown Source)
com.aspose.imaging.Image.a(Unknown Source)
com.aspose.imaging.Image.load(Unknown Source)
com.mycompany.mavenproject1.Main.main(Main.java:35)
— End of inner exception stack trace —
com.aspose.imaging.Image.a(Unknown Source)
com.aspose.imaging.Image.load(Unknown Source)
com.mycompany.mavenproject1.Main.main(Main.java:35)
at com.aspose.imaging.Image.a(Unknown Source)
at com.aspose.imaging.Image.load(Unknown Source)
at com.mycompany.mavenproject1.Main.main(Main.java:35)
Caused by: class com.aspose.imaging.internal.ew.d: Profiles are not supported
com.aspose.imaging.fileformats.dng.DngImage.a(Unknown Source)
com.aspose.imaging.internal.loaders.DngLoader.load(Unknown Source)
com.aspose.imaging.Image.a(Unknown Source)
com.aspose.imaging.Image.load(Unknown Source)
com.mycompany.mavenproject1.Main.main(Main.java:35)
at com.aspose.imaging.fileformats.dng.DngImage.a(Unknown Source)
at com.aspose.imaging.internal.loaders.DngLoader.load(Unknown Source)
… 3 more

BUILD FAILURE

Total time: 1.577s
Finished at: Thu Jun 14 15:55:43 COT 2018
Final Memory: 20M/1959M

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project mavenproject1: Command execution failed. Process exited with an error: 1 (Exit value: 1) → [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation

Source:

package com.mycompany.mavenproject1;

import com.aspose.imaging.Image;
import com.aspose.imaging.License;

public class Main {
public static void main(String[] args){

    //Set Aspose license..
    License license = new com.aspose.imaging.License();
    license.setLicense("Aspose.Imaging.lic");
    if (License.isLicensed()) {
        System.out.println("License is Set!");
    }
    
    //Image paths..
    String imagesPath       = "src/images/";
    String imagePath   = imagesPath + "2P6A3573.tif";

    Image image    = Image.load(imagePath);
    System.out.println("Image loaded");

}

}

@sebastianzapata,

I suggest you to please try using our latest Aspose.Imaging for Java 18.6 on your end. If there is still an issue then please share the source TIFF file with which you are facing issue on your end so that we may proceed further with our investigation.

Hi mudassir.fayyaz,

Sorry that was the issue, I already upgraded and it was fixed.

Now, I’m facing a new issue with the tiff file when saved, it outputs just a noise image, please find the code below:

public class Main {
public static void main(String[] args) throws FileNotFoundException, IOException{

    //Set Aspose license..
    License license = new com.aspose.imaging.License();
    license.setLicense("Aspose.Imaging.lic");
    if (License.isLicensed()) {
        System.out.println("License is Set!");
    }
    
    //Image paths..
    String imagesPath       = "src/images/";
    String flashRightPath   = imagesPath + "2P6A3601.tif";

    Image flashRight    = Image.load(flashRightPath);

TiffOptions outputOptions = new TiffOptions(TiffExpectedFormat.TiffNoCompressionRgb);

    //Save final image..
    flashRight.save(imagesPath + "2P6A3601_output.tif", outputOptions);

}

I just noticed it happens with 16-bit images, 8-bit images are working fine. In the other hand I had to downsize the image because it takes ages to save an 8,000px image which is the resolution I need, I literally waited 15 minutes and it didn’t finish saving, while Photoshop takes only 2-5 seconds. Any reason for this?

Please let me know where I can upload a sample tiff file, your platform doesn’t seem to support the file format nor file size.

Hi, I tried to open and save a PSD file as an alternative… It converts the 16-bit file to 8-bit without any explicit conversion…

String imagesPath = “src/images/”;
String flashRightPath = imagesPath + “2P6A3601.psd”;

PsdImage flashRight = new PsdImage(flashRightPath);
flashRight.save(imagesPath + “2P6A3601_output.psd”);

Hi, I’ve “fixed” the issue with the following code:

String imagesPath = “src/images/”;
String flashRightPath = imagesPath + “2P6A3601.psd”;

PsdImage flashRight = (PsdImage)Image.load(flashRightPath);

flashRight.save(imagesPath + “2P6A3601_output.psd”);

But the issue is now I’m getting a slightly more contrasted image, resulting in loss of data specially in the darkest spots of the image (please see attachment).comparison.jpg (917.2 KB)

@sebastianzapata,

I have observed your comments. I like to inform that you can share zipped tiff file with us and if file is more than 3 MB than please use FTP server or dropbox and share download link with us so that we may further investigate to help you out.

Hi, please find the tiff file here: https:// drive.google.com/file/d/1QF0ooqz_jALoWYMHL-wgWDvgZgwyE7Zb/view?usp=sharing

@sebastianzapata,

I have worked with the image shared by you and have been able to observe the issue. An issue with ID IMAGINGJAVA-1012 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.