HTML to PDF / DOCX / RTF Java converter library Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting sun.awt.image.ImageFormatException: Unsupported color conver

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #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

    #28352

    An image sample and corresponding HTML snippet would help a lot to reproduce the issue on our side.

    #28353

    Yeah… 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?

    #28354

    Of course. Please send it to support pd4ml com

    #28355

    Thank you, I’ve sent you an e-mail.

    Tell me if you have problems to open it.

    #28356

    In 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.

    #28357

    Oh, 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.

    #28358

    It 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.

    #28359

    Hello,
    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.

    #28360

    I 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

    #28361

    Oh, ok, thank you so much!

    I will investigate more while you try to create it. Thanks!

    #28362

    did you achieve something?

    #28363

    The attached code did the CMYK to RGB conversion trick for me.

    #28364

    Oh, thank you so much! It works so fine for me for now

    #28365

    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

Viewing 15 posts - 1 through 15 (of 20 total)

The forum ‘Troubleshooting’ is closed to new topics and replies.