United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4972087 : Quality Desc and Quality Values arrays are of same length for JPG

Details
Type:
Bug
Submit Date:
2003-12-23
Status:
Closed
Updated Date:
2006-12-06
Project Name:
JDK
Resolved Date:
2005-10-10
Component:
client-libs
OS:
generic
Sub-Component:
javax.imageio
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:

Related Reports

Sub Tasks

Description
The API specification for getcompressionQualityDescriptions() claims that the array length of the compression quality values returned by the ImageWriteParam must always be one greater than the array length of quality descriptions returned by the same write param for any image format. This does not work for JPG. For JPG, both the arrays returned are of same length.

This is reproducible right from JDK1.4 on all the platforms.

I have attached a sample code. Execute the sample code and watch the console. If the array length of quality desc and quality values are same then the bug is reproduced.
###@###.### 2003-12-23

Attached the testcase.

###@###.### 2003-12-23

                                    

Comments
EVALUATION

The problem is that when the JPEGImageWriteParam code was written, it was
assumed that the compression quality values have a one-to-one mapping to
the compression quality descriptions.  But with a careful reading of the
ImageWriteParam spec, it is noticed that the descriptions should refer
to a range of values.  (So vals.length should be descs.length+1...)

Since the existing descriptions match specific values, we thought it would
be good to change the descriptions and values slightly to fit:
        "Low quality",       // 0.00 -> 0.30
        "Medium quality",    // 0.30 -> 0.75
        "Visually lossless"  // 0.75 -> 1.00
                                     
2005-09-30



Hardware and Software, Engineered to Work Together