Java Picture Related

Source: Internet
Author: User

Some image suffixes are jpg, but the actual format is not JPG, and the image bytes are downloaded by URL. Then, when reading with ImageIO, there is a case of returning null. In this case, you need to use Webp-imageio.jar. (Https://bitbucket.org/luciad/webp-imageio).

The author, after all, Daniel, given the use of information is too large, the text is very concise, resulting in my use, spend a lot of time groping. Now the summary steps are as follows:

1. Download the compiled executable file on the website: https://bitbucket.org/luciad/webp-imageio/downloads. Source files I have tried, but need to compile, in the Windows environment, compile various errors. (hehe ...) It's a little anxious to write code in Windows these days.

2. The executable file contains the library files for Webp-imageio.jar and the respective platforms.

3. It is recommended that you deploy Webp-imageio.jar to warehousing (install or deploy) through Maven and then introduce the jar into your project through the declarations in the Pom file.

4. Remember that the 2nd step also downloaded the library file, select the platform for the program to run the corresponding library files, copied to "Java.library.path".

PS: The way to find Java.libary.path: Logger.info (System.getproperty ("Java.library.path"));

5. At this point, using ImageIO to read the image of the byte stream, some strange format is supported, so it will not return empty.

Java Picture Related

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.