Class JPEGQuality

java.lang.Object
com.twelvemonkeys.imageio.metadata.jpeg.JPEGQuality

public final class JPEGQuality extends Object
Determines an approximate JPEG compression quality value from the quantization tables.
Version:
$Id: JPEGQuality.java,v 1.0 16.02.12 17:07 haraldk Exp$
  • Field Details

  • Constructor Details

    • JPEGQuality

      public JPEGQuality()
  • Method Details

    • getJPEGQuality

      public static float getJPEGQuality(List<JPEGSegment> segments) throws IOException
      Determines an approximate JPEG compression quality value from the quantization tables. The value will be in the range [0...1], where 1 is the best possible value.
      Parameters:
      segments - a list of JPEG segments containing the DQT quantization tables.
      Returns:
      a float in the range [0...1], representing the JPEG quality, or -1 if the quality can't be determined.
      Throws:
      IIOException - if a JPEG format error is found during parsing.
      IOException - if an I/O exception occurs during parsing.
      See Also:
    • getJPEGQuality

      public static float getJPEGQuality(ImageInputStream input) throws IOException
      Determines an approximate JPEG compression quality value from the quantization tables. The value will be in the range [0...1], where 1 is the best possible value.
      Parameters:
      input - an image input stream containing JPEG data.
      Returns:
      a float in the range [0...1], representing the JPEG quality, or -1 if the quality can't be determined.
      Throws:
      IIOException - if a JPEG format error is found during parsing.
      IOException - if an I/O exception occurs during parsing.
      See Also:
    • getJPEGQuality

      private static int getJPEGQuality(int[][] quantizationTables) throws IOException
      Throws:
      IOException
    • getQTables

      public static JPEGQTable[] getQTables(List<JPEGSegment> segments) throws IOException
      Throws:
      IOException
    • getQuantizationTables

      private static int[][] getQuantizationTables(List<JPEGSegment> dqtSegments) throws IOException
      Throws:
      IOException
    • main

      public static void main(String[] args) throws IOException
      Throws:
      IOException