Info (@NotNull Object input) { ImageIO.setUseCache(false); try (ImageInputStream iis = ImageIO.createImageInputStream(input)) { if (isAppleOptimizedPNG(iis)) { // They are not supported by PNGImageReader return null; } Iterator<ImageReader> it = ImageIO.getImageReaders(iis); ImageReader reader = it.hasNext() ? it.next() : null; if (reader != null) { reader.setInput(iis, true); int w = reader.getWidth(0); int h = reader.getHeight(0); Iterator<ImageTypeSpecifier> it2 = reader.getImageTypes(0); int bpp = it2 != null && it2.hasNext() ? it2.next().getColorModel().getPixelSize() : -1; return new Info(w, h, bpp, false); } } catch (Throwable ignore) {} return null; }