Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported Image Formats #19

Closed
anatolyra opened this issue Dec 24, 2018 · 3 comments
Closed

Unsupported Image Formats #19

anatolyra opened this issue Dec 24, 2018 · 3 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@anatolyra
Copy link

Hi,

I'm facing an issue with about ~4% of the images I'm trying to generate a hash value for are not supported.
The majority of the errors I get are 'UnsupportedOperationException'. I get either:
java.lang.UnsupportedOperationException: The image type is currently not supported: 10
at com.github.kilianB.graphics.FastPixel.create(FastPixel.java:38)
at com.github.kilianB.hashAlgorithms.PerceptiveHash.hash(PerceptiveHash.java:44)
at com.github.kilianB.hashAlgorithms.HashingAlgorithm.hash(HashingAlgorithm.java:122)
Example of an image that gets this error: https://console.brax-cdn.com/creatives/b86bbc0b-1fab-4ae3-9b34-fef78c1a7488/5_1200x800_ee7df89490d518b2f6fb8c739cbbfa30.png

Or:
java.lang.UnsupportedOperationException: The image type is currently not supported: 13
at com.github.kilianB.graphics.FastPixel.create(FastPixel.java:38)
at com.github.kilianB.hashAlgorithms.PerceptiveHash.hash(PerceptiveHash.java:44)
at com.github.kilianB.hashAlgorithms.HashingAlgorithm.hash(HashingAlgorithm.java:122)
Example of an image that generated this error: http://scd.pt.rfi.fr/sites/portugues.filesrfi/dynimagecache/0/42/337/190/1024/578/sites/images.rfi.fr/files/aef_image/dog2.gif

Also, for a small percentage of images I get an 'IllegalArgumentException':
java.lang.IllegalArgumentException: Unknown image type 0
at java.awt.image.BufferedImage.(BufferedImage.java:501)
at com.github.kilianB.graphics.ImageUtil.getScaledInstance(ImageUtil.java:40)
at com.github.kilianB.hashAlgorithms.PerceptiveHash.hash(PerceptiveHash.java:44)
at com.github.kilianB.hashAlgorithms.HashingAlgorithm.hash(HashingAlgorithm.java:122)
For example: https://ocdn.eu/pulscms-transforms/1/xkZktkpTURBXy9iZDgyYWY0YWNmNWRhY2NlZTA1OTZkYTVmNDcwYWUyNC5wbmeSlQMCAM0DTs0B3JMFzQNSzQG9

Is this an expected behavior and will not be fixed? Or is it a bug?

Thank you!

@KilianB
Copy link
Owner

KilianB commented Dec 24, 2018

It is an expected behavior, but certainly not desired. It appears due to https://github.com/KilianB/UtilityCode only supporting byte and int a/rgb image formats. -> monochromatic or ushort encoded images will throw an error.
For a quick fix I can create a fallback to the default java readRgb methods which is much slower but acceptable for this instance (due to rescaling not many read operations take place anyways).
I had an update scheduled for this week releasing a random forest image matcher which automatically chooses the correct algorithm and settings based on labeled test data, maybe I can sneak it into the patch.
(Depending on how busy the Christmas days actually are)

If you can please provide the integer value returned by this method:

bImage.getType()

for the failing images so I see which encoding should be supported the next.

KilianB added a commit to KilianB/UtilityCode that referenced this issue Dec 24, 2018
@KilianB KilianB added bug Something isn't working enhancement New feature or request labels Dec 25, 2018
KilianB added a commit that referenced this issue Dec 25, 2018
Minor version bump resolving #19. Support all types of exotic buffered image types
@KilianB
Copy link
Owner

KilianB commented Dec 25, 2018

Got around to quickly fix it today. Please try version 2.1.1

@anatolyra
Copy link
Author

Thank you for the quick fix! It works perfectly.

@KilianB KilianB closed this as completed Dec 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants