List of utility methods to do ImageIO Usage
void | closeEL(ImageInputStream iis) close EL try { if (iis != null) iis.close(); } catch (Throwable t) { |
IIOMetadataNode | createAsciiField(int number, String name, String val) create Ascii Field IIOMetadataNode field, arrayNode, valueNode; field = new IIOMetadataNode("TIFFField"); field.setAttribute("number", Integer.toString(number)); field.setAttribute("name", name); arrayNode = new IIOMetadataNode("TIFFAsciis"); field.appendChild(arrayNode); valueNode = new IIOMetadataNode("TIFFAscii"); arrayNode.appendChild(valueNode); ... |
ImageWriteParam | createImageWriteParam(ImageWriter writer, float quality) create Image Write Param ImageWriteParam param = writer.getDefaultWriteParam();
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
param.setCompressionQuality(quality);
return param;
|
void | deregisterProvider(final ServiceRegistry registry, final IIOServiceProvider provider, final Class THIS METHOD WILL ME MOVED/RENAMED, DO NOT USE. registry.deregisterServiceProvider(category.cast(provider), category); |
ImageWriteParam | getParams(ImageWriter writer) get Params ImageWriteParam param = writer.getDefaultWriteParam(); try { param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(1.0f); } catch (Throwable ignored) { return param; |
int | guessCompressionRatio(final ImageReaderWriterSpi spi) Guesses the compression ratio for the given image format. if (spi != null) { for (final String format : spi.getFormatNames()) { if (format.equalsIgnoreCase("png")) { return 4; if (format.equalsIgnoreCase("jpeg")) { return 8; if (format.equalsIgnoreCase("tiff")) { return 1; if (format.equalsIgnoreCase("bmp") || format.equalsIgnoreCase("raw")) { return 1; return 0; |
T | lookupProviderByName(final ServiceRegistry registry, final String providerClassName) THIS METHOD WILL ME MOVED/RENAMED, DO NOT USE. try { return (T) registry.getServiceProviderByClass(Class.forName(providerClassName)); } catch (ClassNotFoundException ignore) { return null; |
void | setCompressionQuality(ImageWriteParam params, int quality) set Compression Quality if (quality <= 0) { quality = 1; if (quality > 100) { quality = 100; try { params.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); ... |