简体   繁体   中英

ImageIO.read(FileInputStream) returns null when reading a very large image

I need to read an image, resize it and then save it. However, when reading a very large image, ImageIO#read() returns null.

FileInputStream f = new FileInputStream(imagePath);     
image = ImageIO.read(f);

How is this caused and how can I solve it?

Image I/O has built-in support for GIF, PNG, JPEG, BMP, and WBMP only. Are you trying to load any other type of image than these. See Reading/Loading an Image for details.

You may check the list of registered readers using ImageIO.getReaderFormatNames() . For me it lists [BMP, bmp, jpg, JPG, wbmp, jpeg, png, JPEG, PNG, WBMP, GIF, gif]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM