question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebP: Reading from InputStream with unknown length does not decode (produces black image)

See original GitHub issue

Version information 3.8.2

** The exact output of java --version (or java -version for older Java releases). openjdk version “11.0.3” 2019-04-16 LTS OpenJDK Runtime Environment Corretto-11.0.3.7.1 (build 11.0.3+7-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.3.7.1 (build 11.0.3+7-LTS, mixed mode)

Describe the bug

First of all, thank you for creating a very useful library.

My problem is:

https://github.com/haraldk/TwelveMonkeys/issues/672#issue-1204081521 Similar to the problem above. (only for webp )

In my case, I want to immediately save the image uploaded by the client. It’s not reading a file, it’s saving a byte[] or InputStream as an image file.

Because in my case I am using Spring framework,

From org.springframework.web.multipart.MultipartFile. For example

BufferedImage image = ImageIO.read(multipartFile.getInputStream());

However, the result is that a black image is extracted.

https://github.com/haraldk/TwelveMonkeys/issues/672#issue-1204081521 Seeing the above case, I temporarily solved it like this:

// Once uploaded, save the image as a file to disk. FileCopyUtils.copy(multipartFile.getBytes(), file);

// Read back the file saved to disk. for image processing BufferedImage image = ImageIO.read(file);

// Process the image and save it again.

This works fine, but it’s an unnecessary process. It will take more time.

BufferedImage image = ImageIO.read(multipartFile.getInputStream());

Is there any way to solve the above at once?

thank you!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
haraldkcommented, Aug 2, 2022

Hi,

I’m currently on summer holiday with my family, but I’ll try to make a new release when I’m back in the office.

In the mean time, please try one of the later snapshot-builds, to see if they fix the problem for you. 😀

– Harald K

1reaction
hprangecommented, Jul 27, 2022

Hey @haraldk! I’m having the same issue reported by gjrjf. I see you fixed it on Apr 22nd (https://github.com/haraldk/TwelveMonkeys/commit/9fe87fe10d692c5b9142e0c8f00f4118c07fc49e). However, the latest TwelveMonkeys release is from Feb 22nd. Are you planning to release a new version of TweveMonkeys any time soon? Can I help somehow? I’m very interested in this fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Asked Questions | WebP - Google Developers
What is the maximum size a WebP image can be? WebP is bitstream-compatible with VP8 and uses 14 bits for width and height....
Read more >
Cannot get an image from inputStream - Stack Overflow
I recently did a project transforming images and used img = ImageIO.read(new File(f)) with no problem, but I wrapped it in a try-catch...
Read more >
TwelveMonkeys - Bountysource
WebP : Reading from InputStream with unknown length does not decode (produces black image) ... scaled images are black on the right side...
Read more >
Inconsistent behavior with WebP images · Issue #392 - GitHub
The first image uses URL to open an InputStream, which is thrown directly into BitmapFactory.decodeStream(). It's black or is only partially ...
Read more >
AWS Elemental MediaConvert error codes
MediaConvert returns error codes when transcoding jobs run into problems. You can use CloudWatch Events to track the error codes that the service...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found