How do I convert bufferedimage to / from an image?

I want to convert buffered image to Java awt. Image.

My source image is TIF, so I use Jai to read it as planarimage:

Then I save it as bufferedimage as an object property

For Pdf export (via iText) I need it as Java awt. Image

thank you!

Solution

java. awt. image. Bufferedimage is already Java awt. Image, so you don't need any conversion or conversion You can use bufferedimage instead of image

You can do this directly:

Image tagImg = source.getAsBufferedImage();
// use tagImg with iText library here
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>