HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › Troubleshooting › sun.awt.image.ImageFormatException: Unsupported color conver
- This topic has 19 replies, 3 voices, and was last updated Jul 27, 2015
07:53:37 by hannacch.
-
AuthorPosts
-
January 4, 2011 at 14:15#26504
Hello,
my original HTML document has an image and I get the next Exception when I do pd4ml.render(…) :sun.awt.image.ImageFormatException: Unsupported color conversion request
I tried by changing the image by another with similar width and height but less file size (the original image that fails is 138 KB and the new one is 14KB). When I change it, it works fine.
How can I make it to work with the original size image? It has to be this image because it is from an external server and I cannot change the quality or size.
Thanks
January 4, 2011 at 14:33#28352An image sample and corresponding HTML snippet would help a lot to reproduce the issue on our side.
January 4, 2011 at 14:36#28353Yeah… but by privacy rules of my company I cannot publish the HTML and/or the image in a public topic.
Can I send you an e-mail with them?
January 4, 2011 at 14:37#28354Of course. Please send it to support pd4ml com
January 4, 2011 at 14:46January 4, 2011 at 15:11#28356In order to resolve the issue you would need to convert the hi-res image from CMYK to RGB. CMYK images are not natively supported by Java
The lo-res image is already RGB, so it appears in PDF correctly
We plan to add CMYK support to the forthcoming version of our product, but it will take 1-1.5 months.
January 4, 2011 at 15:17#28357Oh, ok… so I cannot do anything now because the picture URL is in an external server and I cannot manage it. The image will change depending the user selection so I cannot save and modify the picture in my own server.
Thank you so much and I will try it again in some months.
Thank you again.
January 4, 2011 at 15:31#28358It is probably a bit tricky, but you may implement on-a-fly image converter utilizing PD4ML custom resource loader technique
post43.html
and JAI library.January 5, 2011 at 09:05#28359Hello,
I am investigating it… I did some tests and when I check the next condition:img.getColorModel().getColorSpace().getType() == ColorSpace.TYPE_CMYK
I get always false. Debugging my code, I see that the color space is returned as RGB, so this condition cannot be true.
To arrive to this point, I get the image from the external server and I save it in my local server. It is recommended that the final solution doesn’t do that and work always in memory without save temp files.
The picture saved in my hard drive has wrong colours.
I’m a bit lost.
January 5, 2011 at 12:21#28360I opened the hi-res image in Photoshop and made sure: the image color space is CMYK.
> img.getColorModel().getColorSpace().getType() == ColorSpace.TYPE_CMYK
The request would make sense if you have a correctly instantiated Image object. But in your case it has internally thrown a sun.awt.image.ImageFormatException. So I suspect “img” object has default values of some properties.If I have time today or tomorrow I’ll try to create for you an “on-a-fly” converter from CMYK to RGB
January 5, 2011 at 13:02January 10, 2011 at 08:27#28362did you achieve something?
January 11, 2011 at 15:19#28363The attached code did the CMYK to RGB conversion trick for me.
January 12, 2011 at 16:25#28364Oh, thank you so much! It works so fine for me for now
June 24, 2015 at 08:45#28365Hello,
my original HTML document has an image and I get the next Exception when I do pd4ml.render(…) :sun.awt.image.ImageFormatException: Unsupported color conversion request
I tried by changing the image by another with similar width and height but less file size (the original image that fails is 138 KB and the new one is 14KB). When I change it, it works fine.
How can I make it to work with the original size image? It has to be this image because it is from an external server and I cannot change the quality or size.
Thanks
-
AuthorPosts
The forum ‘Troubleshooting’ is closed to new topics and replies.