What is the most useful type of java.awt.image.BufferedImage for off-screen rendering?
awt, graphics, java, swing
Solution
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().
Problem
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?