java - 非RGB图片不能上传?
黄舟
黄舟 2017-04-18 10:13:58
0
1
520
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
阿神

Maybe you need commons-imaging to help you.

ImageInfo  imageInfo = Imaging.getImageInfo(file);
imageInfo.getColorType();

============I downloaded an old version and tried RGB and CMYK====================

ImageInfo imageInfo = Sanselan.getImageInfo(new File("/*.jpg"));
    int type = imageInfo.getColorType();
    if(ImageInfo.COLOR_TYPE_RGB == type){
        System.out.println("RGB");
    }else if(ImageInfo.COLOR_TYPE_CMYK == type){
        System.out.println("CMYK");
    }else{
        System.out.println("other");
    }

The result is correct, no more pictures have been tried to verify.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template