I have an Image. I need to make a exactly copy of it and save it to BufferedImage, but there is no Image.clone(). The thing should be inside a calculating loop and so it should be really fast, no pixel-by-pixel copying. What's the best in perfomance method to do this?
相关问题
- Views base64 encoded blob in HTML with PHP
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- How to get the background from multiple images by
Image clone = original.getScaledInstance(original.getWidth(), -1, Image.SCALE_DEFAULT);
This might not be very pretty, but
getScaledInstance
returns, as the name suggests, an instance of your originalImage
object. Usually only used for resizing.-1
tells the method to keep the aspect ratio as it isYou can draw to a buffered image, so make a blank bufferedImage, create a graphics context from it, and draw your original image to it.
There is another way: