Java 8 IIOImage - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 IIOImage class.

This code example shows how to use the following methods:
			if (imageWriters.hasNext()) {
				imageWriter = imageWriters.next();
				ImageWriteParam iwp = imageWriter.getDefaultWriteParam();
				process(iwp);
				imageWriter.setOutput(imageOutputStream);
				imageWriter.write(null, new IIOImage(image, null, null), iwp);
			} 
			else { 
				throw new HttpMessageNotWritableException(
						"Could not find javax.imageio.ImageWriter for Content-Type [" + contentType + "]");
			} 
		} 
		finally { 
			if (imageWriter != null) {
				imageWriter.dispose();
			} 
			if (imageOutputStream != null) {
				try { 
					imageOutputStream.close();
				} 
7
CodeRank
This code example shows how to use the following methods:
            writer = lookupImageWriterForFormat(imageFormat);
            ios = ImageIO.createImageOutputStream(os);
            writer.setOutput(ios);
            ImageWriteParam iwparam = getImageWriteParameters(writer);
 
            writer.write(null, new IIOImage(bimg, null, null), iwparam);
        } finally { 
            if (ios != null) {
                try { 
                    ios.flush();
                } catch (IOException e) {
                    // ignore 
                } 
                try { 
                    ios.close();
                } catch (IOException e) {
                    // ignore 
                } 
            } 
            if (writer != null) {
6
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
This code example shows how to use the following methods:
            return; 
        } 
 
        ioutstream = ImageIOExt.createImageOutputStream(image, outStream);
        writer.setOutput(ioutstream);
        writer.write(meta, new IIOImage(image, null, meta), param);
        ioutstream.close();
        writer.dispose();
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
    param = new JPEGImageWriteParam(Locale.getDefault());
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) ;
    param.setCompressionQuality(getQuality());
 
    // write the image 
    writer.write(null, new IIOImage(bi, null, null), param);
 
    // cleanup 
    ios.flush();
    writer.dispose();
    ios.close();    
  } 
   
  /** 
   * for testing only. 
   *  
   * @param args the commandline arguments 
   * @throws Exception if something goes wrong 
   */ 
  public static void main(String[] args) throws Exception {
6
CodeRank
This code example shows how to use the following methods:
		ImageWriteParam iwp = iw.getDefaultWriteParam();
		iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
		iwp.setCompressionQuality(_quality);
		ImageOutputStream ios = ImageIO.createImageOutputStream(os);
		iw.setOutput(ios);
		iw.write(null, new IIOImage(image, null, null), iwp);
		ios.flush();
		iw.dispose();
		ios.close();
		return os.toByteArray();
	} 
	/** Returns the quality of the image encoding. 
	 * It is a number between 0 and 1. The higher the value, 
	 * the better the output quality. 
	 * 
	 * <p>Default: 0.95f. 
	 */ 
	public float getQuality() { 
		return _quality;
	} 
6
CodeRank
This code example shows how to use the following methods:
            ImageWriteParam param = writer.getDefaultWriteParam();
            param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
            param.setCompressionQuality(quality);
            ImageOutputStream os = ImageIO.createImageOutputStream(targetJpg);
            writer.setOutput(os);
            writer.write((IIOMetadata) null,
                         new IIOImage(im, null, null),
                         param);
            os.flush();
            os.close();
        } 
        catch (IOException e) {
            throw Lang.wrapThrow(e);
        } 
    } 
 
    /** 
     * 尝试读取JPEG文件的高级方法,可读取32位的jpeg文件 
     * <p/> 
     * 来自: 
6
CodeRank
This code example shows how to use the following methods:
            // Prepare output file. 
            ImageOutputStream ios = ImageIO.createImageOutputStream(out);
            writer.setOutput(ios);
 
            // Write the image. 
            writer.write(null, new IIOImage(image, null, null), iwp);
 
            // Cleanup. 
            ios.flush();
            writer.dispose();
            ios.close();
        } else { 
            ImageIO.write(image, "png", out);
        } 
    } 
 
    @Override 
    public RenderedImage scaleImage(Image image, int width, int height)
    { 
        // Draw the given image to a buffered image object and scale it to the new size on-the-fly. 
6
CodeRank
This code example shows how to use the following methods:
				iwp.setCompressionQuality(compressionQuality); // float between 0 and 1
			} 
			// Write the screen shot to file  
			output = new FileImageOutputStream(file);
			writer.setOutput(output);
			IIOImage image = new IIOImage(screenshot, null, null);
 
			writer.write(null, image, iwp);
		} catch (IOException e) {
			e.printStackTrace();
		} finally { 
			if (writer != null) {
				writer.dispose();
			} 
			if (output != null) {
				try { 
					output.close();
				} catch (IOException e) {
					e.printStackTrace();
				} 
6
CodeRank
See Code Examples for Java 8 IIOImage Methods: