Class JPEGQuality
- java.lang.Object
-
- com.twelvemonkeys.imageio.metadata.jpeg.JPEGQuality
-
public final class JPEGQuality extends java.lang.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 Summary
Fields Modifier and Type Field Description (package private) static int
DCT_SIZE_2
(package private) static int
NUM_QUANT_TABLES
-
Constructor Summary
Constructors Constructor Description JPEGQuality()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
getJPEGQuality(int[][] quantizationTables)
static float
getJPEGQuality(java.util.List<JPEGSegment> segments)
Determines an approximate JPEG compression quality value from the quantization tables.static float
getJPEGQuality(javax.imageio.stream.ImageInputStream input)
Determines an approximate JPEG compression quality value from the quantization tables.static javax.imageio.plugins.jpeg.JPEGQTable[]
getQTables(java.util.List<JPEGSegment> segments)
private static int[][]
getQuantizationTables(java.util.List<JPEGSegment> dqtSegments)
static void
main(java.lang.String[] args)
-
-
-
Field Detail
-
NUM_QUANT_TABLES
static final int NUM_QUANT_TABLES
- See Also:
- Constant Field Values
-
DCT_SIZE_2
static final int DCT_SIZE_2
- See Also:
- Constant Field Values
-
-
Method Detail
-
getJPEGQuality
public static float getJPEGQuality(java.util.List<JPEGSegment> segments) throws java.io.IOException
Determines an approximate JPEG compression quality value from the quantization tables. The value will be in the range[0...1]
, where1
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:
javax.imageio.IIOException
- if a JPEG format error is found during parsing.java.io.IOException
- if an I/O exception occurs during parsing.- See Also:
ImageWriteParam.setCompressionQuality(float)
,JPEG.DQT
-
getJPEGQuality
public static float getJPEGQuality(javax.imageio.stream.ImageInputStream input) throws java.io.IOException
Determines an approximate JPEG compression quality value from the quantization tables. The value will be in the range[0...1]
, where1
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:
javax.imageio.IIOException
- if a JPEG format error is found during parsing.java.io.IOException
- if an I/O exception occurs during parsing.- See Also:
ImageWriteParam.setCompressionQuality(float)
,JPEG.DQT
-
getJPEGQuality
private static int getJPEGQuality(int[][] quantizationTables) throws java.io.IOException
- Throws:
java.io.IOException
-
getQTables
public static javax.imageio.plugins.jpeg.JPEGQTable[] getQTables(java.util.List<JPEGSegment> segments) throws java.io.IOException
- Throws:
java.io.IOException
-
getQuantizationTables
private static int[][] getQuantizationTables(java.util.List<JPEGSegment> dqtSegments) throws java.io.IOException
- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args) throws java.io.IOException
- Throws:
java.io.IOException
-
-