不知道你说的是不是这个 ImageInfo ii = new ImageInfo(); // in can be InputStream or RandomAccessFile (or DataInput) ii.setInput(in); /* if you want to know how many images there are in a file, uncomment the following line; will slow down ImageInfo with animated GIFs */ //ii.setDetermineImageNumber(true);// check does the actual work, you won't get results before // you have called it if (!ii.check()) { System.err.println("Not a supported image file format."); } else { System.out.println( ii.getFormatName() + ", " + ii.getMimeType() + ", " + ii.getWidth() + " x " + ii.getHeight() + " pixels, " + ii.getBitsPerPixel() + " bits per pixel, " + ii.getNumberOfImages() + " image(s)."); // there are other properties, check out the API documentation } http://www.jahia.org/javadoc-dev_5/org/jahia/tools/imageprocess/ImageInfo.html http://schmidt.devlib.org/image-info/
ImageInfo ii = new ImageInfo();
// in can be InputStream or RandomAccessFile (or DataInput)
ii.setInput(in);
/* if you want to know how many images there are in a file,
uncomment the following line; will slow down ImageInfo
with animated GIFs */
//ii.setDetermineImageNumber(true);// check does the actual work, you won't get results before
// you have called it
if (!ii.check())
{
System.err.println("Not a supported image file format.");
}
else
{
System.out.println(
ii.getFormatName() + ", " +
ii.getMimeType() + ", " +
ii.getWidth() + " x " + ii.getHeight() + " pixels, " +
ii.getBitsPerPixel() + " bits per pixel, " +
ii.getNumberOfImages() + " image(s).");
// there are other properties, check out the API documentation
}
http://www.jahia.org/javadoc-dev_5/org/jahia/tools/imageprocess/ImageInfo.html
http://schmidt.devlib.org/image-info/