Package com.sun.image.codec.jpeg

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


      }

      public void writeTo(Object obj, OutputStream out) {
         if(obj instanceof BufferedImage)
         {
            JPEGImageEncoder enc = JPEGCodec.createJPEGEncoder(out);
            try
            {
               enc.encode((BufferedImage)obj);
            }
            catch (IOException e)
            {
               throw new WSException("Failed to convert " + obj.getClass());
            }
View Full Code Here


            }
            encodeParam.setQuality(q / 100.0f, false);
        }

        try {
            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os, encodeParam);
            encoder.encode(img);
        } catch (IOException e) {
            throw new SimpleImageException(e);
        } catch (ImageFormatException e) {
            throw new SimpleImageException(e);
        }
View Full Code Here

  JPEGEncodeParam j2dEP = convertToJ2DJPEGEncodeParam(paramList, sm) ;
        ((JPEGParam)j2dEP).setWidth(ras.getWidth()) ;
  ((JPEGParam)j2dEP).setHeight(ras.getHeight()) ;

  JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(baos, j2dEP) ;
  encoder.encode(ras) ;

  byte[] data = baos.toByteArray() ;

  ObjectOutputStream oos = new ObjectOutputStream(outputStream) ;
  oos.writeFloat(paramList.getFloatParameter("quality"));
View Full Code Here

            g.drawImage(src_biao, (wideth - wideth_biao) / 2,
                        (height - height_biao) / 2, wideth_biao, height_biao, null);
            //ˮӡ�ļ�����
            g.dispose();
            FileOutputStream out = new FileOutputStream(targetImg);
            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
            encoder.encode(image);
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

            g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP,
                Alpha));
            g.drawString(pressText, wideth / 2 - x, height / 2 - y);
            g.dispose();
            FileOutputStream out = new FileOutputStream(targetImg);
            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
            encoder.encode(image);
            out.close();
            //System.out.print("������ӳɹ�");
        } catch (Exception e) {
            System.out.println(e);
        }
View Full Code Here

          int width = inWidth ;
          int height = inHeight ;
          BufferedImage bufferedImage = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB) ;
          bufferedImage.getGraphics().drawImage(image, 0, 0, width, height,null) ;
          FileOutputStream fos = new FileOutputStream(outFilePath) ;
          JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos) ;
          encoder.encode(bufferedImage) ;
          fos.close();
      } catch (IOException e) {
          e.printStackTrace();
      }
   
View Full Code Here

          int width = inWidth ;
          int height = inHeight ;
          BufferedImage bufferedImage = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB) ;
          bufferedImage.getGraphics().drawImage(image, 0, 0, width, height,null) ;
          FileOutputStream fos = new FileOutputStream(outFilePath) ;
          JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos) ;
          encoder.encode(bufferedImage) ;
          fos.close();
      } catch (IOException e) {
          e.printStackTrace();
      }
   
View Full Code Here

  try {
   BufferedImage image=robot.createScreenCapture(new Rectangle(toolkit.getScreenSize()));
   ByteArrayOutputStream output=new ByteArrayOutputStream();
   JPEGEncodeParam param=JPEGCodec.getDefaultJPEGEncodeParam(image);
   param.setQuality(0.1f,true);
   JPEGImageEncoder encoder=JPEGCodec.createJPEGEncoder(output,param);
   encoder.encode(image);
   encoder.getOutputStream().close();
   DatagramPacket packet=new DatagramPacket(output.toByteArray(),output.size
(),address);
   this.socket.send(packet);
  } catch (Exception e) {
   e.printStackTrace();
View Full Code Here

          int width = inWidth ;
          int height = inHeight ;
          BufferedImage bufferedImage = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB) ;
          bufferedImage.getGraphics().drawImage(image, 0, 0, width, height,null) ;
          FileOutputStream fos = new FileOutputStream(outFilePath) ;
          JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos) ;
          encoder.encode(bufferedImage) ;
          fos.close();
      } catch (IOException e) {
          e.printStackTrace();
      }
   
View Full Code Here

          int width = inWidth ;
          int height = inHeight ;
          BufferedImage bufferedImage = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB) ;
          bufferedImage.getGraphics().drawImage(image, 0, 0, width, height,null) ;
          FileOutputStream fos = new FileOutputStream(outFilePath) ;
          JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos) ;
          encoder.encode(bufferedImage) ;
          fos.close();
      } catch (IOException e) {
          e.printStackTrace();
      }
   
View Full Code Here

TOP

Related Classes of com.sun.image.codec.jpeg.JPEGImageEncoder

Copyright © 2018 www.massapicom. 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.