Package java.awt.image

Examples of java.awt.image.BufferedImage.createGraphics()


    BufferedImage image = new BufferedImage(
      (int)size.getWidth(),
      (int)size.getHeight(),
      BufferedImage.TYPE_INT_BGR
      );
    contentContext.render(image.createGraphics(),size);
    return image;
  }
}
View Full Code Here


      }

      // Log.log("ServletExtension: i2 size : "+i2.getWidth(comp)+"x"+i2.getHeight(comp));

      dest = new BufferedImage(destWidth, destHeight, BufferedImage.TYPE_INT_RGB);
      Graphics2D big = dest.createGraphics();
      big.drawImage(i2, 0, 0, comp);

      // Log.log("ServletExtension: dest size : "+dest.getWidth()+"x"+dest.getHeight());
    }
View Full Code Here

   * @return - the new resized image
   */
  private static Image getScaledImage(Image srcImg, int w, int h) {
    BufferedImage resizedImg = new BufferedImage(w, h,
                                                 BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = resizedImg.createGraphics();
    g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                        RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g2.drawImage(srcImg, 0, 0, w, h, null);
    g2.dispose();
    return resizedImg;
View Full Code Here

       
        System.out.println("final height:"+height+" width: "+thumbWidth);
       
        img = imageScreen.getScaledInstance(Double.valueOf(thumbWidth).intValue(), Double.valueOf(height).intValue() ,Image.SCALE_SMOOTH);
        image = new BufferedImage(Double.valueOf(thumbWidth).intValue(), Double.valueOf(height).intValue(),BufferedImage.TYPE_INT_RGB);
        Graphics2D biContext = image.createGraphics();
        biContext.drawImage(img, 0, 0, null);

       
      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
      JPEGEncodeParam encpar = encoder.getDefaultJPEGEncodeParam(image);
View Full Code Here

                      //Resize to 640*480
                      // Create new (blank) image of required (scaled) size
                      BufferedImage image_raw = new BufferedImage(width_new, height_new, BufferedImage.TYPE_INT_RGB);   
                     
                     
                      Graphics2D graphics2D = image_raw.createGraphics();
                      graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                      graphics2D.drawImage(image, 0, 0, width_new, height_new, null);
                      graphics2D.dispose();
                       
                      //End resize
View Full Code Here

                      //Resize to 640*480
                      // Create new (blank) image of required (scaled) size
                      BufferedImage image_raw = new BufferedImage(width_new, height_new, BufferedImage.TYPE_INT_RGB);   
                     
                     
                      Graphics2D graphics2D = image_raw.createGraphics();
                      graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                      graphics2D.drawImage(image, 0, 0, width_new, height_new, null);
                      graphics2D.dispose();
                       
                      //End resize
View Full Code Here

                              //Resize to 640*480
                              // Create new (blank) image of required (scaled) size
                              BufferedImage image_raw = new BufferedImage(width_new, height_new, BufferedImage.TYPE_INT_RGB);   
                             
                             
                              Graphics2D graphics2D = image_raw.createGraphics();
                              graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                              graphics2D.drawImage(image, 0, 0, width_new, height_new, null);
                              graphics2D.dispose();
                               
                              //End resize
View Full Code Here

                              //Resize to 640*480
                              // Create new (blank) image of required (scaled) size
                              BufferedImage image_raw = new BufferedImage(width_new, height_new, BufferedImage.TYPE_INT_RGB);   
                             
                             
                              Graphics2D graphics2D = image_raw.createGraphics();
                              graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                              graphics2D.drawImage(image, 0, 0, width_new, height_new, null);
                              graphics2D.dispose();
                               
                              //End resize
View Full Code Here

      int height) throws IOException {
    BufferedImage image = ImageIO.read(originalImageUrl);
    BufferedImage scaledImage = new BufferedImage(width, height,
        BufferedImage.TYPE_INT_ARGB);
    // BufferedImage.TYPE_INT_RGB);
    Graphics2D g = scaledImage.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
        RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
    g.setRenderingHint(RenderingHints.KEY_RENDERING,
View Full Code Here

      //TYPE_BYTE_GRAY //13202
      //TYPE_BYTE_BINARY //13812--
      //TYPE_BYTE_INDEXED //24545
      BufferedImage image = new BufferedImage(scaledWidth, scaledHeight,BufferedImage.TYPE_3BYTE_BGR);
     
      Graphics2D biContext = image.createGraphics();
      biContext.drawImage(img, 0, 0, null);
     
      ByteArrayOutputStream out = new ByteArrayOutputStream();
     
      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.