哪种图像类型相当于 5

which image type is equivalent to 5

我写了下面的代码来检查图像的类型"RGB,BGR or any other type"。当我 运行 我收到的代码值等于 5,我也检查了文档 here 但我仍然不知道哪种类型等于数字 5!

请告诉我如何知道与 5 等效的图像类型。

代码:

public class MainClass {

public static void main(String[] args) throws IOException {

    File imgFile = new File("c:\img.jpg");
    BufferedImage bi = ImageIO.read(imgFile);

    System.out.println(bi.getType());
}

}

TYPE_3BYTE_BGR:

/**
 * Represents an image with 8-bit RGB color components, corresponding 
 * to a Windows-style BGR color model) with the colors Blue, Green,
 * and Red stored in 3 bytes.  There is no alpha.  The image has a
 * <code>ComponentColorModel</code>.
 * When data with non-opaque alpha is stored
 * in an image of this type,
 * the color data must be adjusted to a non-premultiplied form
 * and the alpha discarded,
 * as described in the
 * {@link java.awt.AlphaComposite} documentation.
 */
public static final int TYPE_3BYTE_BGR = 5;

阅读您提供的 getType() 文档后,我找到了 "See Also" 中的图像类型列表。这导致了 Constant Field Values 文档。 5 似乎等同于 "TYPE_3BYTE_BGR".