Hello Everyone,

I am facing another issue. I am fetching some images from source and store
them to destination and just before destination processor I have
ResizeImage Processor.

Now my images can be JPEG or PNG. Processor documentation mentioned that it
can handle both but it is failing for PNG files with the following error:

ResizeImage[id=2b2bf869-0dcb-351d-857b-bbeef6f27fcf]
ResizeImage[id=2b2bf869-0dcb-351d-857b-bbeef6f27fcf] failed to process
due to java.lang.IllegalArgumentException: Unknown image type 0;
rolling back session: Unknown image type 0


I did some digging and it seems like the issue is with ImageIO library
being used for resizing.
https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-media-bundle/nifi-media-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java#L177

As per this thread "image.getType()" method is the one which creates
problem.
https://www.thecodingforums.com/threads/imageio-have-problem-of-reading-png.141174/

https://stackoverflow.com/questions/5836128/how-do-i-make-javas-imagebuffer-to-read-a-png-file-correctly

So seems like for PNG files image.getType returns 0 but it is expecting 5.

*Is there any workaround for this without changing the code?*

If there is none, I can fix the code and use (can also submit a pull
request with the fix but I am not sure how to do that.)

Kind Regards,
Raman

Reply via email to