JDK-4418221 : JPEG plug-in does not handle custom bit depth images correctly
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: solaris_7
  • CPU: generic
  • Submitted: 2001-02-23
  • Updated: 2002-03-07
  • Resolved: 2002-02-09
Related Reports
Relates :  
Description
The JPEG plug-in handles images with low bit depths incorrectly.  For example,
for a BufferedImage of type TYPE_USHORT_565_RGB a pixel values of (31, 63, 31)
should produce white, not olive green.  The same problem occurs when reading
into a user-supplied BufferedImage as well as when encoding such an image.

The existing regression test in test/javax/imageio/BitDepth.java
may be used to demonstrate the encoding problem.

/////////////////////////
al.smith@eng 2001-05-29
Regression test javax/imageio/BitDepth.java fails with Merlin build 63b on Solaris 9, host jetfly.  While attempting to verify this fix, this test failed with the .jtr file output below.
 For test hardware config's, see http://sqesvr.eng/st3/jdk1.4/docs/Merlin-hw.html

#Test Results (version 2)
#Fri May 25 22:09:17 PDT 2001
#checksum:8727dd0847cbfda
#-----testdescription-----
$file=/net/sqesvr/export/st1/regression/merlin/jdk1.4Tests/tests/b63b/javax/imageio/BitDepth.java
$root=/net/sqesvr/export/st1/regression/merlin/jdk1.4Tests/tests/b63b
keywords=bug4413109 bug4418221
run=USER_SPECIFIED main BitDepth\n
source=BitDepth.java
title=Checks that the PNG and JPEG writers can handle various BufferedImage types

#-----environment-----

#-----testresult-----
description=file:///net/sqesvr/export/st1/regression/merlin/jdk1.4Tests/tests/b63b/javax/imageio/BitDepth.java
end=Fri May 25 22:09:17 PDT 2001
environment=regtest
execStatus=Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Test failed
javatestOS=SunOS 5.9 (sparc)
javatestVersion=2.1.5
script=com.sun.javatest.regtest.RegressionScript 
sections=script_messages build compile main
start=Fri May 25 22:09:08 PDT 2001
status=Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Test failed
test=javax/imageio/BitDepth.java
work=/export0/results/regression/merlin/b63b/jetfly5.9-jth13-jdk14b63b.05-25.18.30-ALL/javax/imageio

#section:script_messages
----------messages:(4/252)----------
JDK under test: (/net/sqesvr/export/st1/jdk14-beta/b63b/solsparc)
java version "1.4.0-beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b63b)
Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b63b, mixed mode)

#section:build
----------messages:(3/94)----------
command: build BitDepth 
reason: Named class compiled on demand
elapsed time (seconds): 4.433
result: Passed. Compilation successful

#section:compile
----------messages:(3/190)----------
command: compile /net/sqesvr/export/st1/regression/merlin/jdk1.4Tests/tests/b63b/javax/imageio/BitDepth.java 
reason: .class file out of date or does not exist
elapsed time (seconds): 4.417
----------System.out:(0/0)----------
----------System.err:(0/0)----------
result: Passed. Compilation successful

#section:main
----------messages:(3/103)----------
command: main BitDepth
reason: User specified action: run main BitDepth 
elapsed time (seconds): 4.621
----------System.out:(7/253)----------
Testing png writer for type INT_RGB
Testing png writer for type INT_BGR
Testing png writer for type 3BYTE_BGR
Testing png writer for type USHORT_565_RGB
Couldn't read image!
Testing png writer for type USHORT_555_RGB
Testing png writer for black stripe
----------System.err:(15/763)----------
java.lang.RuntimeException: Test failed
	at BitDepth.testFormat(BitDepth.java:130)
	at BitDepth.<init>(BitDepth.java:104)
	at BitDepth.main(BitDepth.java:20)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:30)
	at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAccessorImpl.java:48)
	at java.lang.reflect.Method.invoke(Method.java:306)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:579)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Test failed
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Test failed
result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Test failed

test result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Test failed

Comments
PUBLIC COMMENTS JPEG plug-in does not handle custom bit depth images correctly
10-06-2004

EVALUATION Scale samples as needed. This bug partially seems to be a duplicate of 4474819 (No 16-bit PNG writers found on Windows/Linux). The jtreg failure seen in the attached stack trace is caused by 4474819 and has nothing to do with the JPEG plug-in. I've tested the JPEGImageWriter with a TYPE_USHORT_565_RGB image (and other types as well) and I am unable to reproduce the "olive green" problem as described, so it seems that the problem has been resolved by an earlier fix. Therefore, I'm closing this bug as not reproducible. ###@###.### 2002-02-08
08-02-2002