Does anyone know how to print a BufferedImage in Java?
相关问题
- 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
I'm not sure what you mean by print. Print on a printer? Print to standard out? Write to a file?
You can check out this tutorial from sun. If you're looking to write to a file. Open in your favorite image tool and print from there.
http://download.oracle.com/javase/tutorial/2d/images/saveimage.html
If you're building a graphical app and using something like AWT you can using the java printing API which would probably require some tap dancing.
Printing is just like drawing on the screen, so eventually you get a Graphics object, and you just drawImage into it.
I'm trying to do that by extending BufferedImage to implement the Printable interface like so (a collage of code I found from around the web):