Class JpegEncoder

  • All Implemented Interfaces:
    com.idrsolutions.image.Encoder

    public class JpegEncoder
    extends com.idrsolutions.image.JDeliImage
    implements com.idrsolutions.image.Encoder
    Class writes BufferedImages as Baseline JPEGs

    Example:

    
     JpegEncoder encoder = new JpegEncoder();
     //encoder.getEncoderOptions().setQuality(75); //50 is default
     encoder.write(bufferedImage, outputStream);
     
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      JpegEncoderOptions getEncoderOptions()  
      int getQuality()
      Deprecated.
      - use getEncoderOptions().getQuality();
      void setQuality​(int percentage)
      Deprecated.
      - use jpegEncoderOptions.setQuality(int percentage); setEncoderOptions(jpegEncoderOptions);
      void write​(java.awt.image.BufferedImage image, java.io.OutputStream out)
      Writes BufferedImage as Baseline JPEG to an OutputStream
      • Methods inherited from class com.idrsolutions.image.JDeliImage

        optimiseImage
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JpegEncoder

        public JpegEncoder()
    • Method Detail

      • write

        public void write​(java.awt.image.BufferedImage image,
                          java.io.OutputStream out)
                   throws java.io.IOException
        Writes BufferedImage as Baseline JPEG to an OutputStream

        This method does not close the provided OutputStream after the write operation has completed; it is the responsibility of the caller to close the stream.

        Specified by:
        write in interface com.idrsolutions.image.Encoder
        Parameters:
        image - BufferedImage The image to write
        out - The stream to write to
        Throws:
        java.io.IOException - if the image wasn't written
      • setQuality

        @Deprecated
        public void setQuality​(int percentage)
        Deprecated.
        - use jpegEncoderOptions.setQuality(int percentage); setEncoderOptions(jpegEncoderOptions);
      • getQuality

        @Deprecated
        public int getQuality()
        Deprecated.
        - use getEncoderOptions().getQuality();