// 这种方法如果遇到不是图片类型的文件会reader抛异常! public static void main(String[] args) throws IOException { // get image format in a file File file = new File("C:/Users/dell./Desktop/2.txt"); // create an image input stream from the specified fileDD ImageInputS
public static final String TYPE_JPG = "jpg"; public static final String TYPE_GIF = "gif"; public static final String TYPE_PNG = "png"; public static final String TYPE_BMP = "bmp"; public static final String TYPE_UNK
java裁剪图片保存到指定位置 /** * 图片裁剪通用接口 * * @param src 源图片地址,图片格式PNG * @param dest 目的图片地址 * @param x 图片起始点x坐标 * @param y 图片起始点y坐标 * @param w 图片宽度 * @param h 图片高度 * @throws IOException 异常处理 */ public void cutImage(String src, String dest, int x, int y, int w,