Examples of JPEGImageEncoder


Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

    Graphics2D big = bi.createGraphics();
    big.drawImage(ii.getImage(), 0, 0, p);

    ByteArrayOutputStream os = new ByteArrayOutputStream();

    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
    try {
      encoder.encode(bi);
    } catch (IOException ex) {
      throw new IllegalArgumentException(ex);
    }
    imageData = os.toByteArray();
  }
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

    Graphics2D big = bi.createGraphics();
    big.drawImage(ii.getImage(), 0, 0, p);

    ByteArrayOutputStream os = new ByteArrayOutputStream();

    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
    try {
      encoder.encode(bi);
    } catch (IOException ex) {
      throw new IllegalArgumentException(ex);
    }
    imageData = os.toByteArray();
  }
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

    Graphics2D big = bi.createGraphics();
    big.drawImage(ii.getImage(), 0, 0, p);

    ByteArrayOutputStream os = new ByteArrayOutputStream();

    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
    try {
      encoder.encode(bi);
    } catch (IOException ex) {
      throw new IllegalArgumentException(ex);
    }
    imageData = os.toByteArray();
  }
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

    Graphics2D big = bi.createGraphics();
    big.drawImage(ii.getImage(), 0, 0, p);

    ByteArrayOutputStream os = new ByteArrayOutputStream();

    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
    try {
      encoder.encode(bi);
    } catch (IOException ex) {
      throw new IllegalArgumentException(ex);
    }
    imageData = os.toByteArray();
  }
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

          src.getScaledInstance((int) (width * rate),
              (int) (height * rate), Image.SCALE_SMOOTH), x, y,
          null);

      FileOutputStream out = new FileOutputStream(imgdist);
      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);

      encoder.encode(tag);
      out.close();

    } catch (IOException ex) {
      System.out.println("处理图片异常.");
      // ex.printStackTrace();
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

  {
    try
    {
      File file = new File(path);
      FileOutputStream out = new FileOutputStream(file);
      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
      JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(buff);
      param.setQuality(1.0f, true);
      encoder.setJPEGEncodeParam(param);
      encoder.encode(buff);
      out.close();
    } // try
    catch (IOException ioe)
    {
      ioe.printStackTrace();
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

        BufferedImage imgX = new BufferedImage( in.getWidth(),in.getHeight(),BufferedImage.TYPE_INT_RGB );
       
        imgX.getGraphics().drawImage(img,0,0,null);
       

        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( out );

        JPEGEncodeParam param;
        param = encoder.getDefaultJPEGEncodeParam( imgX );
        param.setQuality( (float)quality.getValue(), true );
        encoder.encode( imgX, param );

     } catch(Exception e)
     {
        element.jException("Fehler in Methode code JPEGDECODER: "+ e.toString());
     }
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

        BufferedImage imgX = new BufferedImage( in.getWidth(),in.getHeight(),BufferedImage.TYPE_INT_RGB );
       
        imgX.getGraphics().drawImage(img,0,0,null);
       

        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( out );

        JPEGEncodeParam param;
        param = encoder.getDefaultJPEGEncodeParam( imgX );
        param.setQuality( (float)quality.getValue(), true );
        encoder.encode( imgX, param );

     } catch(Exception e)
     {
        element.jException("Fehler in Methode code JPEGDECODER: "+ e.toString());
     }
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

        graphics.setColor(Color.white);

        //graphics.fillRect(0, 0, (int)s.getWidth(), (int)s.getHeight());
        cnt.print(graphics);

        JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(out);
        JPEGEncodeParam encodeParam = JPEGCodec.getDefaultJPEGEncodeParam(bufferedImage);
        encodeParam.setQuality((float) 0.9, true);
        jpegEncoder.encode(bufferedImage, encodeParam);
        graphics.dispose();
        bufferedImage.flush();
    }
View Full Code Here

Examples of com.sun.image.codec.jpeg.JPEGImageEncoder

      BufferedImage bufferedImage = new BufferedImage(newWidth,
          newHeight, BufferedImage.TYPE_INT_RGB);
      bufferedImage.getGraphics().drawImage(
          src.getScaledInstance(width, height, Image.SCALE_SMOOTH),
          0, 0, null);
      JPEGImageEncoder encoder = JPEGCodec
          .createJPEGEncoder(imgOutputStream);
      encoder.encode(bufferedImage);
      imgOutputStream.flush();
      imgOutputStream.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
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.