Class JpegEncoder

java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.jpeg.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);
 
  • Field Summary

    Fields inherited from class com.idrsolutions.image.JDeliImage

    bb
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    JpegEncoder(com.idrsolutions.image.encoder.options.EncoderOptions format)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    int
    Deprecated.
    - use getEncoderOptions().getQuality();
    void
    setQuality(int percentage)
    Deprecated.
    - use jpegEncoderOptions.setQuality(int percentage); setEncoderOptions(jpegEncoderOptions);
    void
    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 Details

    • JpegEncoder

      public JpegEncoder(com.idrsolutions.image.encoder.options.EncoderOptions format)
    • JpegEncoder

      public JpegEncoder()
  • Method Details

    • getEncoderOptions

      public JpegEncoderOptions getEncoderOptions()
    • write

      public void write(BufferedImage image, OutputStream out) throws 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:
      IOException - if the image wasn't written
    • setQuality

      @Deprecated public void setQuality(int percentage)
      Deprecated.
      - use jpegEncoderOptions.setQuality(int percentage); setEncoderOptions(jpegEncoderOptions);
      Parameters:
      percentage - value used for image compression
    • getQuality

      @Deprecated public int getQuality()
      Deprecated.
      - use getEncoderOptions().getQuality();
      Returns:
      value used for image compression