Exception "Image loading failed" when loading image using Aspose.Imaging for Java

Hi

I am trying an EPS file using sample code from Manipulating Photoshop Formats|Documentation

" Support for EPS Format" section

And am getting error :

Exception in thread “main” class com.aspose.imaging.coreexceptions.ImageLoadException: Image loading failed. —> class com.aspose.imaging.internal.Exceptions.ArgumentException: EPS Binary PostScript offset is less than header size
com.aspose.imaging.internal.gA.b.c(Unknown Source)
com.aspose.imaging.internal.gA.b.c(Unknown Source)
com.aspose.imaging.internal.gA.a.b(Unknown Source)
com.aspose.imaging.internal.gA.g.b(Unknown Source)
com.aspose.imaging.internal.gA.g.a(Unknown Source)
com.aspose.imaging.internal.jc.m.load(Unknown Source)
com.aspose.imaging.Image.a(Unknown Source)
com.aspose.imaging.Image.load(Unknown Source)
ImagingTest.convertImageEPS(ImagingTest.java:332)
ImagingTest.processImage(ImagingTest.java:95)
ImagingTest.main(ImagingTest.java:62)
— End of inner exception stack trace —
com.aspose.imaging.Image.a(Unknown Source)
com.aspose.imaging.Image.load(Unknown Source)
ImagingTest.convertImageEPS(ImagingTest.java:332)
ImagingTest.processImage(ImagingTest.java:95)
ImagingTest.main(ImagingTest.java:62)
at com.aspose.imaging.Image.a(Unknown Source)
at com.aspose.imaging.Image.load(Unknown Source)
at ImagingTest.convertImageEPS(ImagingTest.java:332)
at ImagingTest.processImage(ImagingTest.java:95)
at ImagingTest.main(ImagingTest.java:62)
Caused by: class com.aspose.imaging.internal.Exceptions.ArgumentException: EPS Binary PostScript offset is less than header size
com.aspose.imaging.internal.gA.b.c(Unknown Source)
com.aspose.imaging.internal.gA.b.c(Unknown Source)
com.aspose.imaging.internal.gA.a.b(Unknown Source)
com.aspose.imaging.internal.gA.g.b(Unknown Source)
com.aspose.imaging.internal.gA.g.a(Unknown Source)
com.aspose.imaging.internal.jc.m.load(Unknown Source)
com.aspose.imaging.Image.a(Unknown Source)
com.aspose.imaging.Image.load(Unknown Source)
ImagingTest.convertImageEPS(ImagingTest.java:332)
ImagingTest.processImage(ImagingTest.java:95)
ImagingTest.main(ImagingTest.java:62)
at com.aspose.imaging.internal.gA.b.c(Unknown Source)
at com.aspose.imaging.internal.gA.b.c(Unknown Source)
at com.aspose.imaging.internal.gA.a.b(Unknown Source)
at com.aspose.imaging.internal.gA.g.b(Unknown Source)
at com.aspose.imaging.internal.gA.g.a(Unknown Source)
at com.aspose.imaging.internal.jc.m.load(Unknown Source)
… 5 more

Here’ my code for this:

EpsImage epsImage = (EpsImage) Image.load(imagePath);
		try {
			// check if EPS image has any raster preview to proceed (for now only raster
			// preview is supported)
			if (epsImage.hasRasterPreview()) {
				if (epsImage.getPhotoshopThumbnail() != null) {
					// process Photoshop thumbnail if it's present
				}

			if (epsImage.getEpsType() == EpsType.Interchange) {
				// Get EPS Interchange subformat instance
				EpsInterchangeImage epsInterchangeImage = (EpsInterchangeImage) epsImage;

				if (epsInterchangeImage.getRasterPreview() != null) {
					// process black-and-white Interchange raster preview if it's present
				}
			} else {
				// Get EPS Binary subformat instance
				EpsBinaryImage epsBinaryImage = (EpsBinaryImage) epsImage;

				if (epsBinaryImage.getTiffPreview() != null) {
					// process TIFF preview if it's present
				}

				if (epsBinaryImage.getWmfPreview() != null) {
					// process WMF preview if it's present
				}
			}

			// export EPS image to PNG (by default, best available quality preview is used
			// for export)
			epsImage.save(imagePath + ".png", new PngOptions());
		}
	} finally {
		epsImage.close();
	}

I was working on code to convert EPS to PDF and that is failing so thought I’ll try your example first which in this case is also failing.
I have also added question on converting EPS to PDF using similar code here

Please help38233Y.EPS.zip (9.8 KB)

@sachin1988,

I have worked with the sample file shared by you and have been able to observe the issue specified. An issue with ID IMAGINGJAVA-1133 has been created in our issue tracking system to investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once issue will be fixed.

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