ImageIO.getImageReadersを使う。
http://stackoverflow.com/questions/4530348/detecting-image-encoding-in-javaImageInputStream imageInputStream = ImageIO.createImageInputStream( myInputStream); Iterator<ImageReader> iter = ImageIO.getImageReaders(imageInputStream); if (!iter.hasNext()) { // this always happens } ImageReader reader = (ImageReader) iter.next(); if (!reader.getFormatName().equals("jpeg")) { }
0 件のコメント:
コメントを投稿