I am creating a buffered image that is going to be a snapshot of a JComponent (via paint()) and rendered inside an ImageIcon. There are a large amount of types in the BufferedImage(int width, int height, int imageType)
constructor, but which one should I use?
I am sure that any of them would work, but which ones are better than the others? How should I pick one? And Why?
See GraphicsConfiguration.createCompatibleImage(int, int) for a helper to create a BufferedImage of a "good" type among the many available types.
How to get your hands on a GraphicsConfiguration instance to make this call? It depends on where your code is executing. See the many methods for getting your hands on a GraphicsConfiguration via methods like getGraphicsConfiguration() or getDeviceConfiguration().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With