I'm having an image on disk. I want to convert it to a BufferedImage so that i can apply filters on it. Is there any way to do this?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
To load an image from a specific file use the following code:
read more Reading/Loading an Image.
Working with Images
The safest way to convert a regular
Image
to aBufferedImage
is just creating a newBufferedImage
and painting theImage
on it, like so:This may not be the best way regarding performance, but it is sure to always work.
use ImageIO.read(File) . It returns BufferedImage :
Try this, Use class "javax.imageio.ImageIO" like
Also refer this link
http://www.dzone.com/snippets/converting-images
Java 2D™ supports loading these external image formats into its BufferedImage format using its
Image I/O API
which is in thejavax.imageio
package. Image I/O has built-in support for GIF, PNG, JPEG, BMP, and WBMP.To load an image from a specific file use the following code: