Skip to main content

poor JPEG2000 image quality with setEncodingRate

32 replies [Last post]
jiezhang
Offline
Joined: 2005-12-29
Points: 0

JPEG2000 image quality is good only with setEncodingRate(Double.MAX_VALUE) or lossless.
When setEncodingRate(Double.MAX_VALUE*number), where number is from 0.01 to 0.99,
the image quality is very poor and there is no difference between different encoding rate.
Is there any more parameters need to set?

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kumarshash
Offline
Joined: 2007-08-20
Points: 0

Hi
I am using the below test program and when I change the setEncodingRate form 0.1 to 0.9 .output image size is always constant not changing.

Input image is 16 bit unsigned gray scal image ..

Below is the test program .. Pls any one can help me out .

import java.io.InputStream;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.File;

import java.awt.Rectangle;

import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.ImageWriter;
import javax.imageio.ImageReadParam;
import javax.imageio.ImageWriteParam;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.IIOImage;

import java.awt.image.BufferedImage;
import java.awt.image.SampleModel;
import java.awt.image.PixelInterleavedSampleModel;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.Dimension;
import java.awt.image.DirectColorModel;
import java.awt.image.SinglePixelPackedSampleModel;
import java.awt.image.renderable.ParameterBlock;
import java.awt.image.RenderedImage;

import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;
import javax.media.jai.PlanarImage;
import javax.media.jai.Interpolation;

import javax.media.jai.TileCache;

import com.sun.media.jai.codec.FileSeekableStream;
import com.sun.media.imageio.plugins.jpeg2000.J2KImageWriteParam;

public class Testj2k {

public static void main(String[] args) {
long startTime = 0, endTime = 0;
startTime = System.currentTimeMillis();

String inputFileName = "C:\\brain.tiff";
String inputFormat = "tiff";
String outputFileName = "C:\\brain.jp2";
String outputFormat = "jpeg2000";

try {

RenderedImage img = ImageIO.read((new File(inputFileName)));

Iterator writers = ImageIO
.getImageWritersByFormatName(outputFormat);
ImageWriter writer = null;
while (writers.hasNext()) {
writer = (ImageWriter) writers.next();
if (writer.getClass().getName().startsWith(
"com.sun.media.imageio")) {
// Break on finding the core provider.
break;
}
}
if (writer == null) {
throw new Exception("Cannot find core "
+ outputFormat.toUpperCase() + " writer!");
}

File f = new File(outputFileName);
ImageOutputStream ios = ImageIO.createImageOutputStream(f);
writer.setOutput(ios);

ImageWriteParam wp = writer.getDefaultWriteParam();
for (int i = 0; i < wp.getCompressionTypes().length; i++)
System.out.println(i + "th type: " + wp.getCompressionTypes());

if (wp instanceof J2KImageWriteParam) {
J2KImageWriteParam paramJ2K = (J2KImageWriteParam) wp;
paramJ2K.setLossless(false);
paramJ2K.setFilter("w9x7");
System.out.println("setEncodingRate "+wp.getCompressionTypes()[0]);

paramJ2K.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
paramJ2K.setCompressionType(wp.getCompressionTypes()[0]);
paramJ2K.setEncodingRate(0.08);

// paramJ2K.setCompressionQuality(0.5f);
wp = paramJ2K;

}

writer.write(null, new IIOImage(img, null, null), wp);
endTime = System.currentTimeMillis();
ios.close();
System.out.println("the file length is " + f.length());

} catch (Exception e) {
System.err
.println("Exception! In image convert: " + e.getMessage());
e.printStackTrace();
} catch (Error e) {
System.err.println("Error! In image convert: " + e.getMessage());
e.printStackTrace();
}

System.out.println("the time is " + (endTime - startTime) + " millisec");

}

}

robert engels

There does appear to be a bug. The problem is that the image is not
truncated if it already exists. You need to delete the image file
manually. Please file a bug.

I used the following testcase to test. Yyou need to use the patch
already in the issue tracker, or you need to change to use
setEncodingRate().

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.*;

public class TestWriteJP2 {

public static void main(String args[]) throws Exception {
File file = new File("/tmp/ugray.jp2");
file.delete();

BufferedImage bi = new BufferedImage(800, 600,
BufferedImage.TYPE_USHORT_GRAY);
Graphics2D g = bi.createGraphics();
try {
g.setColor(Color.WHITE);
int height = g.getFontMetrics().getHeight();
for (int x = 0; x < 800; x += 200) {
for (int y = height; y < 600; y += height) {
g.drawString("This is a test line at " + x + "," + y, x, y);
}
}
} finally {
g.dispose();
}

ImageWriter w = ImageIO.getImageWritersByFormatName("jpeg2000").next();
w.setOutput(ImageIO.createImageOutputStream(file));
ImageWriteParam p = w.getDefaultWriteParam();
p.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
p.setCompressionType(p.getCompressionTypes()[0]);
p.setCompressionQuality(0.1f);

w.write(null, new IIOImage(bi, null, null), p);
w.dispose();
}
}

On Aug 21, 2007, at 10:55 AM, jai-imageio@javadesktop.org wrote:

> Hi
> I am using the below test program and when I change the
> setEncodingRate form 0.1 to 0.9 .output image size is always
> constant not changing.
>
> Input image is 16 bit unsigned gray scal image ..
>
> Below is the test program .. Pls any one can help me out .
>
> import java.io.InputStream;
> import java.io.FileInputStream;
> import java.io.OutputStream;
> import java.io.FileOutputStream;
> import java.io.File;
>
> import java.awt.Rectangle;
>
> import java.util.Iterator;
>
> import javax.imageio.ImageIO;
> import javax.imageio.ImageReader;
> import javax.imageio.ImageWriter;
> import javax.imageio.ImageReadParam;
> import javax.imageio.ImageWriteParam;
> import javax.imageio.stream.ImageInputStream;
> import javax.imageio.stream.ImageOutputStream;
> import javax.imageio.ImageTypeSpecifier;
> import javax.imageio.IIOImage;
>
> import java.awt.image.BufferedImage;
> import java.awt.image.SampleModel;
> import java.awt.image.PixelInterleavedSampleModel;
> import java.awt.image.ColorModel;
> import java.awt.image.DataBuffer;
> import java.awt.image.DataBufferByte;
> import java.awt.Dimension;
> import java.awt.image.DirectColorModel;
> import java.awt.image.SinglePixelPackedSampleModel;
> import java.awt.image.renderable.ParameterBlock;
> import java.awt.image.RenderedImage;
>
> import javax.media.jai.JAI;
> import javax.media.jai.RenderedOp;
> import javax.media.jai.PlanarImage;
> import javax.media.jai.Interpolation;
>
> import javax.media.jai.TileCache;
>
> import com.sun.media.jai.codec.FileSeekableStream;
> import com.sun.media.imageio.plugins.jpeg2000.J2KImageWriteParam;
>
> public class Testj2k {
>
> public static void main(String[] args) {
> long startTime = 0, endTime = 0;
> startTime = System.currentTimeMillis();
>
> String inputFileName = "C:\\brain.tiff";
> String inputFormat = "tiff";
> String outputFileName = "C:\\brain.jp2";
> String outputFormat = "jpeg2000";
>
> try {
>
> RenderedImage img = ImageIO.read((new File(inputFileName)));
>
> Iterator writers = ImageIO
> .getImageWritersByFormatName(outputFormat);
> ImageWriter writer = null;
> while (writers.hasNext()) {
> writer = (ImageWriter) writers.next();
> if (writer.getClass().getName().startsWith(
> "com.sun.media.imageio")) {
> // Break on finding the core provider.
> break;
> }
> }
> if (writer == null) {
> throw new Exception("Cannot find core "
> + outputFormat.toUpperCase() + " writer!");
> }
>
> File f = new File(outputFileName);
> ImageOutputStream ios = ImageIO.createImageOutputStream(f);
> writer.setOutput(ios);
>
> ImageWriteParam wp = writer.getDefaultWriteParam();
> for (int i = 0; i < wp.getCompressionTypes().length; i++)
> System.out.println(i + "th type: " + wp.getCompressionTypes());
>
> if (wp instanceof J2KImageWriteParam) {
> J2KImageWriteParam paramJ2K = (J2KImageWriteParam) wp;
> paramJ2K.setLossless(false);
> paramJ2K.setFilter("w9x7");
> System.out.println("setEncodingRate "+wp.getCompressionTypes()
> [0]);
>
> paramJ2K.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
> paramJ2K.setCompressionType(wp.getCompressionTypes()[0]);
> paramJ2K.setEncodingRate(0.08);
>
> // paramJ2K.setCompressionQuality(0.5f);
> wp = paramJ2K;
>
> }
>
> writer.write(null, new IIOImage(img, null, null), wp);
> endTime = System.currentTimeMillis();
> ios.close();
> System.out.println("the file length is " + f.length());
>
>
>
> } catch (Exception e) {
> System.err
> .println("Exception! In image convert: " + e.getMessage());
> e.printStackTrace();
> } catch (Error e) {
> System.err.println("Error! In image convert: " + e.getMessage());
> e.printStackTrace();
> }
>
>
> System.out.println("the time is " + (endTime - startTime) + "
> millisec");
>
> }
>
> }
> [Message sent by forum member 'kumarshash' (kumarshash)]
>
> http://forums.java.net/jive/thread.jspa?messageID=231835
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

kumarshash
Offline
Joined: 2007-08-20
Points: 0

Thx for the reply .Pls can you send me the link where I can download the "patch
already in the issue tracker"
OR
your saying use setCompressionQuality instead of setEncodingRate.
Pls let me know if i understood coorectly .

Thx

robert engels

You can use the setEncodingRate. The patch is in the imageio-core
project. Search the issues.

On Aug 21, 2007, at 6:39 PM, jai-imageio@javadesktop.org wrote:

> Thx for the reply .Pls can you send me the link where I can
> download the "patch
> already in the issue tracker"
> OR
> your saying use setCompressionQuality instead of setEncodingRate.
> Pls let me know if i understood coorectly .
>
> Thx
> [Message sent by forum member 'kumarshash' (kumarshash)]
>
> http://forums.java.net/jive/thread.jspa?messageID=231901
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

kumarshash
Offline
Joined: 2007-08-20
Points: 0

Hi ,
I will do that .
One more thing i uses below code to use CodecLib and MemoryCacheImageOutputStream but still the same problem .
Any idea pls let me know ....

String IMAGE_MIME_TYPE = "image/jpeg2000";
Iterator writers = javax.imageio.ImageIO
.getImageWritersByMIMEType(IMAGE_MIME_TYPE);
ImageWriter writer = null;

writer = (ImageWriter) writers.next();

while (writer.getClass().getName().endsWith("CodecLib")
&& writers.hasNext()) {
writer = (ImageWriter) writers.next();
}

bytes = new ByteArrayOutputStream();
MemoryCacheImageOutputStream outStream = new MemoryCacheImageOutputStream(
bytes);
writer.setOutput(outStream);

J2KImageWriteParam wp = (J2KImageWriteParam) writer
.getDefaultWriteParam();
wp.setWriteCodeStreamOnly(true);
wp.setProgressionType("res");
wp.setCompressionMode(J2KImageWriteParam.MODE_EXPLICIT);

if (wp instanceof J2KImageWriteParam) {
J2KImageWriteParam paramJ2K = (J2KImageWriteParam) wp;
paramJ2K.setLossless(false);
paramJ2K.setFilter("w9x7");
// System.out.println("setEncodingRate "+wp.getCompressionTypes()[0]);

paramJ2K.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
paramJ2K.setCompressionType(wp.getCompressionTypes()[0]);
// 0.9 size 29238 .
// 0.1 3256
paramJ2K.setEncodingRate(0.8);

// paramJ2K.setCompressionQuality(0.1f);
wp = paramJ2K;

}
writer.write(null, new IIOImage(img, null, null), wp);
endTime = System.currentTimeMillis();
writer.dispose();
try {
outStream.flush();
outStream.close();

} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

robert engels

I already filed the bug. The sample code I provided works fine. Use
that (with the patch, or change to setEncodingRate)

On Aug 22, 2007, at 9:52 AM, jai-imageio@javadesktop.org wrote:

> Hi ,
> I will do that .
> One more thing i uses below code to use CodecLib and
> MemoryCacheImageOutputStream but still the same problem .
> Any idea pls let me know ....
>
> String IMAGE_MIME_TYPE = "image/jpeg2000";
> Iterator writers = javax.imageio.ImageIO
> .getImageWritersByMIMEType(IMAGE_MIME_TYPE);
> ImageWriter writer = null;
>
> writer = (ImageWriter) writers.next();
>
> while (writer.getClass().getName().endsWith("CodecLib")
> && writers.hasNext()) {
> writer = (ImageWriter) writers.next();
> }
>
> bytes = new ByteArrayOutputStream();
> MemoryCacheImageOutputStream outStream = new
> MemoryCacheImageOutputStream(
> bytes);
> writer.setOutput(outStream);
>
> J2KImageWriteParam wp = (J2KImageWriteParam) writer
> .getDefaultWriteParam();
> wp.setWriteCodeStreamOnly(true);
> wp.setProgressionType("res");
> wp.setCompressionMode(J2KImageWriteParam.MODE_EXPLICIT);
>
> if (wp instanceof J2KImageWriteParam) {
> J2KImageWriteParam paramJ2K = (J2KImageWriteParam) wp;
> paramJ2K.setLossless(false);
> paramJ2K.setFilter("w9x7");
> // System.out.println("setEncodingRate "+wp.getCompressionTypes
> ()[0]);
>
> paramJ2K.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
> paramJ2K.setCompressionType(wp.getCompressionTypes()[0]);
> // 0.9 size 29238 .
> // 0.1 3256
> paramJ2K.setEncodingRate(0.8);
>
> // paramJ2K.setCompressionQuality(0.1f);
> wp = paramJ2K;
>
> }
> writer.write(null, new IIOImage(img, null, null), wp);
> endTime = System.currentTimeMillis();
> writer.dispose();
> try {
> outStream.flush();
> outStream.close();
>
> } catch (IOException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> [Message sent by forum member 'kumarshash' (kumarshash)]
>
> http://forums.java.net/jive/thread.jspa?messageID=232010
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

kumarshash
Offline
Joined: 2007-08-20
Points: 0

Hi
I didn't find the patch .Pls can you point me the patch link .
Also bit confused with what you meant by "change to setEncodingRate "

Pls let me know

robert engels

If you don't apply the patch, you can just use setEncodingRate() and
the J2KWriteParam.

The patch is in the imageio-core project on java.net in the issue
tracker.

On Aug 22, 2007, at 10:10 AM, jai-imageio@javadesktop.org wrote:

> Hi
> I didn't find the patch .Pls can you point me the patch link .
> Also bit confused with what you meant by "change to setEncodingRate "
>
> Pls let me know
> [Message sent by forum member 'kumarshash' (kumarshash)]
>
> http://forums.java.net/jive/thread.jspa?messageID=232018
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

kumarshash
Offline
Joined: 2007-08-20
Points: 0

In your sample code i just changed to use codecLib instead of "com.sun.media.imageio"

codecLib :after setEncodingRate(1.0) it gives constant files size .
com.sun.media.imageio : after setEncodingRate(1.0) it gives different file size .

below is the code to choose codecLib or imageio .
Any idea ....?

Iterator writers = ImageIO
.getImageWritersByFormatName(outputFormat);
ImageWriter writer = null;
while (writers.hasNext()) {
writer = (ImageWriter) writers.next();
if (writer.getClass().getName().startsWith(
"com.sun.media.imageio")) {
// Break on finding the core provider.
break;
}
}
// OR
// codecLib

// String IMAGE_MIME_TYPE = "image/jpeg2000";
// Iterator writers = javax.imageio.ImageIO
// .getImageWritersByMIMEType(IMAGE_MIME_TYPE);
// ImageWriter writer = null;
//
// writer = (ImageWriter) writers.next();
//
// while (writer.getClass().getName().endsWith("CodecLib")
// && writers.hasNext()) {
// writer = (ImageWriter) writers.next();
// }

Pls let me know ....

thx in advance for all your help

robert engels

I don't have an ability to test the CodecLib version since I run
under OSX, but I found the following in the code: It looks like the
codec and java versions interpret the Encoding rate value
differently. I don't have the source to the codec lib wrapper, so
this is all of the information I have.

It looks like you need to setEncodingRate(bitsPerPixel). Since
lossless is 16, you want to set that value to be somewhere 0.0 < 16.0
to peform compression.

I have filed a bug on this issue (https://jai-imageio.dev.java.net/
issues/show_bug.cgi?id=18)

// set the rate
double rate = param.getEncodingRate();
if (rate != Double.MAX_VALUE) {
// convert the rate to the medialib definition
rate /= ImageUtil.getElementSize(sampleModel);
encoder.setRate(rate, 0);
} else
encoder.setRate(0.0, 0);

On Aug 22, 2007, at 10:31 AM, jai-imageio@javadesktop.org wrote:

> In your sample code i just changed to use codecLib instead of
> "com.sun.media.imageio"
>
> codecLib :after setEncodingRate(1.0) it gives constant files size .
> com.sun.media.imageio : after setEncodingRate(1.0) it gives
> different file size .
>
> below is the code to choose codecLib or imageio .
> Any idea ....?
>
> Iterator writers = ImageIO
> .getImageWritersByFormatName(outputFormat);
> ImageWriter writer = null;
> while (writers.hasNext()) {
> writer = (ImageWriter) writers.next();
> if (writer.getClass().getName().startsWith(
> "com.sun.media.imageio")) {
> // Break on finding the core provider.
> break;
> }
> }
> // OR
> // codecLib
>
> // String IMAGE_MIME_TYPE = "image/jpeg2000";
> // Iterator writers = javax.imageio.ImageIO
> // .getImageWritersByMIMEType(IMAGE_MIME_TYPE);
> // ImageWriter writer = null;
> //
> // writer = (ImageWriter) writers.next();
> //
> // while (writer.getClass().getName().endsWith("CodecLib")
> // && writers.hasNext()) {
> // writer = (ImageWriter) writers.next();
> // }
>
> Pls let me know ....
>
> thx in advance for all your help
> [Message sent by forum member 'kumarshash' (kumarshash)]
>
> http://forums.java.net/jive/thread.jspa?messageID=232027
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

[att1.html]

kumarshash
Offline
Joined: 2007-08-20
Points: 0

Thx ! I tried setting 0.0 < 16.0 . It is not working .
After 1.0 it always gives same size .
Totaly confused .

robert engels

That may just be a bug in the codec based encoder. You probably need
to file a bug, along with the simple self contained testcase. I would
use mine as an example since it does not need any external image files.

On Aug 22, 2007, at 11:19 AM, jai-imageio@javadesktop.org wrote:

> Thx ! I tried setting 0.0 < 16.0 . It is not working .
> After 1.0 it always gives same size .
> Totaly confused .
> [Message sent by forum member 'kumarshash' (kumarshash)]
>
> http://forums.java.net/jive/thread.jspa?messageID=232047
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Nidel, Mike

Wow, so my reading of the API docs for J2KImageWriteParam was totally
wrong.
Well, my apologies. However, it seems like the documentation is not
clear.

"bits-per-pixel" doesn't seem to suggest a number from 0.0-1.0.

> -----Original Message-----
> From: robert engels [mailto:rengels@ix.netcom.com]
> Sent: Wednesday, August 15, 2007 7:08 PM
> To: interest@jai-imageio.dev.java.net
> Subject: Re: [JAI-IMAGEIO] poor JPEG2000 image quality with
> setEncodingRate
>
> i figured it out, the encoding rate needs to be a value
> between 0.0 and 1.0
>
> It is basically a multiplier on the number of bytes in the file.
>
> So, if the image file "lossless" was 100k, a encoding rate of
> .9 would give you a resulting file of 90k. Similarly an
> encoding rate of .1 would give you a file of 10k.
>
> I tested it and it works correctly.
>
> It can be hard to discern the difference when working with
> many images. For example, I used a value of .05 on a 600k
> image. The resulting file was 30k and it was still was very
> close to the original.
>
> That is the great thing about JPEG2000 !
>
> Good luck.
>
> Robert
>
> On Aug 15, 2007, at 5:43 PM, jai-imageio@javadesktop.org wrote:
>
> > brain.tif is 16bit grayscale.
> > The program works. But you only get same result with different
> > encoding rates.
> > [Message sent by forum member 'jiezhang' (jiezhang)]
> >
> > http://forums.java.net/jive/thread.jspa?messageID=231042
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> > For additional commands, e-mail: interest-help@jai-
> > imageio.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

jiezhang
Offline
Joined: 2005-12-29
Points: 0

Thanks Rob.
Will test more and come back.

robert engels

i figured it out, the encoding rate needs to be a value between 0.0
and 1.0

It is basically a multiplier on the number of bytes in the file.

So, if the image file "lossless" was 100k, a encoding rate of .9
would give you a resulting file of 90k. Similarly an encoding rate
of .1 would give you a file of 10k.

I tested it and it works correctly.

It can be hard to discern the difference when working with many
images. For example, I used a value of .05 on a 600k image. The
resulting file was 30k and it was still was very close to the original.

That is the great thing about JPEG2000 !

Good luck.

Robert

On Aug 15, 2007, at 5:43 PM, jai-imageio@javadesktop.org wrote:

> brain.tif is 16bit grayscale.
> The program works. But you only get same result with different
> encoding rates.
> [Message sent by forum member 'jiezhang' (jiezhang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=231042
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

robert engels

Also, be careful when testing lossless compression of binary (bi-
level) or indexed images. Many modern viewers do not support it
(Preview on OSX).

On Aug 15, 2007, at 6:07 PM, robert engels wrote:

> i figured it out, the encoding rate needs to be a value between 0.0
> and 1.0
>
> It is basically a multiplier on the number of bytes in the file.
>
> So, if the image file "lossless" was 100k, a encoding rate of .9
> would give you a resulting file of 90k. Similarly an encoding rate
> of .1 would give you a file of 10k.
>
> I tested it and it works correctly.
>
> It can be hard to discern the difference when working with many
> images. For example, I used a value of .05 on a 600k image. The
> resulting file was 30k and it was still was very close to the
> original.
>
> That is the great thing about JPEG2000 !
>
> Good luck.
>
> Robert
>
> On Aug 15, 2007, at 5:43 PM, jai-imageio@javadesktop.org wrote:
>
>> brain.tif is 16bit grayscale.
>> The program works. But you only get same result with different
>> encoding rates.
>> [Message sent by forum member 'jiezhang' (jiezhang)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=231042
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
>> For additional commands, e-mail: interest-help@jai-
>> imageio.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

robert engels

Works fine for me when I use a grayscale image. It fails when using a
binary (b & w) image, but as the documentation states, lossy
compression is not supported for binary images.

My guess is that your source file is binary and not grayscale.

On Aug 15, 2007, at 4:40 PM, jai-imageio@javadesktop.org wrote:

> Test case is following. Pretty simple.
>
>
> package testimageio;
> import java.io.InputStream;
> import java.io.FileInputStream;
> import java.io.OutputStream;
> import java.io.FileOutputStream;
> import java.io.File;
>
> import java.awt.Rectangle;
>
> import java.util.Iterator;
>
> import javax.imageio.ImageIO;
> import javax.imageio.ImageReader;
> import javax.imageio.ImageWriter;
> import javax.imageio.ImageReadParam;
> import javax.imageio.ImageWriteParam;
> import javax.imageio.stream.ImageInputStream;
> import javax.imageio.stream.ImageOutputStream;
> import javax.imageio.ImageTypeSpecifier;
> import javax.imageio.IIOImage;
>
> import java.awt.image.BufferedImage;
> import java.awt.image.SampleModel;
> import java.awt.image.PixelInterleavedSampleModel;
> import java.awt.image.ColorModel;
> import java.awt.image.DataBuffer;
> import java.awt.image.DataBufferByte;
> import java.awt.Dimension;
> import java.awt.image.DirectColorModel;
> import java.awt.image.SinglePixelPackedSampleModel;
> import java.awt.image.renderable.ParameterBlock;
> import java.awt.image.RenderedImage;
>
> import javax.media.jai.JAI;
> import javax.media.jai.RenderedOp;
> import javax.media.jai.PlanarImage;
> import javax.media.jai.Interpolation;
>
> import javax.media.jai.TileCache;
>
> import com.sun.media.jai.codec.FileSeekableStream;
> import com.sun.media.imageio.plugins.jpeg2000.J2KImageWriteParam;
>
>
> public class TestJ2k {
>
> public static void main(String[] args) {
> long startTime = 0, endTime = 0;
> startTime = System.currentTimeMillis();
>
> String inputFileName = "/tmp/brain.tif";
> String inputFormat = "tiff";
> String outputFileName = "/tmp/brain.jp2";
> String outputFormat = "jpeg2000";
>
> try {
>
> RenderedImage img = ImageIO.read((new File
> (inputFileName)));
>
> Iterator writers = ImageIO.getImageWritersByFormatName
> (outputFormat);
> ImageWriter writer = null;
> while(writers.hasNext()) {
> writer = (ImageWriter)writers.next();
> if(writer.getClass().getName().startsWith
> ("com.sun.media.imageio")) {
> // Break on finding the core provider.
> break;
> }
> }
> if(writer == null) {
> throw new Exception("Cannot find core " +
> outputFormat.toUpperCase() + " writer!");
> }
>
> File f = new File(outputFileName);
> ImageOutputStream ios = ImageIO.createImageOutputStream
> (f);
> writer.setOutput(ios);
>
>
> ImageWriteParam wp = writer.getDefaultWriteParam();
> for(int i=0; i > System.out.println(i + "th type: " +
> wp.getCompressionTypes()[i]);
>
> if(wp instanceof J2KImageWriteParam) {
> J2KImageWriteParam paramJ2K = (J2KImageWriteParam)wp;
> paramJ2K.setLossless(false);
> paramJ2K.setFilter("w9x7");
> paramJ2K.setEncodingRate(Double.MAX_VALUE*0.2);
> wp = paramJ2K;
>
> }
>
> writer.write(null,new IIOImage(img, null, null),wp);
>
> System.out.println("the file length is " + f.length());
>
> ios.close();
>
>
> } catch (Exception e) {
> System.err.println("Exception! In image convert: " +
> e.getMessage());
> e.printStackTrace();
> } catch (Error e) {
> System.err.println("Error! In image convert: " +
> e.getMessage());
> e.printStackTrace();
> }
>
>
> endTime = System.currentTimeMillis();
> System.out.println("the time is " + (endTime-startTime) +
> "millisec");
>
> }
>
>
> }
>
>
>
>> Maybe if you posted a fully compilable and runnable
>> test case you
>> might get better answers...
>>
>> On Aug 15, 2007, at 3:57 PM,
>> jai-imageio@javadesktop.org wrote:
>>
>>> Whatever.
>>> No matter what value is used in setEncodingRate. It
>> does not work.
>>> It seems there is only one type of lossy encoding.
>>> [Message sent by forum member 'jiezhang'
>> (jiezhang)]
>>>
>>>
>> http://forums.java.net/jive/thread.jspa?messageID=2310
>> 26
>>>
>>>
>> ------------------------------------------------------
>> ---------------
>>> To unsubscribe, e-mail:
>> interest-unsubscribe@jai-imageio.dev.java.net
>>> For additional commands, e-mail: interest-help@jai-
>>
>>> imageio.dev.java.net
>>>
>>
>> ------------------------------------------------------
>> ---------------
>> To unsubscribe, e-mail:
>> interest-unsubscribe@jai-imageio.dev.java.net
>> For additional commands, e-mail:
>> interest-help@jai-imageio.dev.java.net
> [Message sent by forum member 'jiezhang' (jiezhang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=231032
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

jiezhang
Offline
Joined: 2005-12-29
Points: 0

brain.tif is 16bit grayscale.
The program works. But you only get same result with different encoding rates.

robert engels

It does appear that there is a bug and that the standard
ImageWriteParm values are not being processed.

Since you should be able to use code like this:

if(wp.canWriteCompressed()) {
for(int i=0; i System.out.println(i + "th type: " +
wp.getCompressionTypes()[i]);

wp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
wp.setCompressionType(wp.getCompressionTypes()[0]);
wp.setCompressionQuality(0.5f);
}

I checked the source, and it doesn't appear to be handled.

On Aug 15, 2007, at 5:43 PM, jai-imageio@javadesktop.org wrote:

> brain.tif is 16bit grayscale.
> The program works. But you only get same result with different
> encoding rates.
> [Message sent by forum member 'jiezhang' (jiezhang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=231042
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

[att1.html]

robert engels

It is a double value, because it will use a fractional amount of bits
per pixel, say 1.5. This is possible with lossy compression. It all
depends on what is required to encode it.

On Aug 15, 2007, at 12:09 PM, jai-imageio@javadesktop.org wrote:

> I did try some integer number in setEncodingRate but they did not
> work.
> I tried with 2, 4, 8, 16. With these numbers the image content was
> totally lost and whole image became black.
> It is very confusing why bits-per-pixel is a double value.
> [Message sent by forum member 'jiezhang' (jiezhang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=230985
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

jiezhang
Offline
Joined: 2005-12-29
Points: 0

Whatever.
No matter what value is used in setEncodingRate. It does not work.
It seems there is only one type of lossy encoding.

robert engels

Maybe if you posted a fully compilable and runnable test case you
might get better answers...

On Aug 15, 2007, at 3:57 PM, jai-imageio@javadesktop.org wrote:

> Whatever.
> No matter what value is used in setEncodingRate. It does not work.
> It seems there is only one type of lossy encoding.
> [Message sent by forum member 'jiezhang' (jiezhang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=231026
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

jiezhang
Offline
Joined: 2005-12-29
Points: 0

Test case is following. Pretty simple.

package testimageio;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.File;

import java.awt.Rectangle;

import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.ImageWriter;
import javax.imageio.ImageReadParam;
import javax.imageio.ImageWriteParam;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.IIOImage;

import java.awt.image.BufferedImage;
import java.awt.image.SampleModel;
import java.awt.image.PixelInterleavedSampleModel;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.Dimension;
import java.awt.image.DirectColorModel;
import java.awt.image.SinglePixelPackedSampleModel;
import java.awt.image.renderable.ParameterBlock;
import java.awt.image.RenderedImage;

import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;
import javax.media.jai.PlanarImage;
import javax.media.jai.Interpolation;

import javax.media.jai.TileCache;

import com.sun.media.jai.codec.FileSeekableStream;
import com.sun.media.imageio.plugins.jpeg2000.J2KImageWriteParam;

public class TestJ2k {

public static void main(String[] args) {
long startTime = 0, endTime = 0;
startTime = System.currentTimeMillis();

String inputFileName = "/tmp/brain.tif";
String inputFormat = "tiff";
String outputFileName = "/tmp/brain.jp2";
String outputFormat = "jpeg2000";

try {

RenderedImage img = ImageIO.read((new File(inputFileName)));

Iterator writers = ImageIO.getImageWritersByFormatName(outputFormat);
ImageWriter writer = null;
while(writers.hasNext()) {
writer = (ImageWriter)writers.next();
if(writer.getClass().getName().startsWith("com.sun.media.imageio")) {
// Break on finding the core provider.
break;
}
}
if(writer == null) {
throw new Exception("Cannot find core " + outputFormat.toUpperCase() + " writer!");
}

File f = new File(outputFileName);
ImageOutputStream ios = ImageIO.createImageOutputStream(f);
writer.setOutput(ios);

ImageWriteParam wp = writer.getDefaultWriteParam();
for(int i=0; i System.out.println(i + "th type: " + wp.getCompressionTypes()[i]);

if(wp instanceof J2KImageWriteParam) {
J2KImageWriteParam paramJ2K = (J2KImageWriteParam)wp;
paramJ2K.setLossless(false);
paramJ2K.setFilter("w9x7");
paramJ2K.setEncodingRate(Double.MAX_VALUE*0.2);
wp = paramJ2K;

}

writer.write(null,new IIOImage(img, null, null),wp);

System.out.println("the file length is " + f.length());

ios.close();

} catch (Exception e) {
System.err.println("Exception! In image convert: " + e.getMessage());
e.printStackTrace();
} catch (Error e) {
System.err.println("Error! In image convert: " + e.getMessage());
e.printStackTrace();
}

endTime = System.currentTimeMillis();
System.out.println("the time is " + (endTime-startTime) + "millisec");

}

}

> Maybe if you posted a fully compilable and runnable
> test case you
> might get better answers...
>
> On Aug 15, 2007, at 3:57 PM,
> jai-imageio@javadesktop.org wrote:
>
> > Whatever.
> > No matter what value is used in setEncodingRate. It
> does not work.
> > It seems there is only one type of lossy encoding.
> > [Message sent by forum member 'jiezhang'
> (jiezhang)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=2310
> 26
> >
> >
> ------------------------------------------------------
> ---------------
> > To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> > For additional commands, e-mail: interest-help@jai-
>
> > imageio.dev.java.net
> >
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net

Brian Burkhalter

And you said that "brain.tif" is of what bit depth? I assume that it is
grayscale.

On Wed, 15 Aug 2007, jai-imageio@javadesktop.org wrote:

> Test case is following. Pretty simple.
>
> String inputFileName = "/tmp/brain.tif";

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

robert engels

Are you sure it is not a binary image? If so, only lossless encoding
is supported.

On Aug 15, 2007, at 4:53 PM, Brian Burkhalter wrote:

> And you said that "brain.tif" is of what bit depth? I assume that
> it is grayscale.
>
> On Wed, 15 Aug 2007, jai-imageio@javadesktop.org wrote:
>
>> Test case is following. Pretty simple.
>>
>> String inputFileName = "/tmp/brain.tif";
>
> ----------------
> Brian Burkhalter
> Java Media, Imaging, and Graphics
> Sun Microsystems, Inc.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> This email message is for the sole use of the intended recipient(s)
> and may contain confidential and privileged information. Any
> unauthorized review, use, disclosure or distribution is prohibited.
> If you are not the intended recipient, please contact the sender by
> reply email and destroy all copies of the original message.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

bocanguoi
Offline
Joined: 2007-07-25
Points: 0

I run TestJ2k.java but it can't work

0th type: [Ljava.lang.String;@a32b
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d6ce837, pid=2812, tid=1640
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_12-b04 mixed mode, sharing)
# Problematic frame:
# V [jvm.dll+0x8e837]
#
# An error report file with more information is saved as hs_err_pid2812.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

bpb
Offline
Joined: 2004-06-23
Points: 0

So in reviewing this thread it appears that everything has been covered by the jai-imageio issues 14, 17, 18 , and 19, is that correct?

Brian

robert engels

Yes - at least what was discussed here.

On Aug 24, 2007, at 11:36 AM, jai-imageio@javadesktop.org wrote:

> So in reviewing this thread it appears that everything has been
> covered by the jai-imageio issues 14, 17, 18 , and 19, is that
> correct?
>
> Brian
> [Message sent by forum member 'bpb' (bpb)]
>
> http://forums.java.net/jive/thread.jspa?messageID=232518
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Brian Burkhalter

Thanks for the update and all your posts in this thread.

Brian

On Fri, 24 Aug 2007, robert engels wrote:

> Yes - at least what was discussed here.
>
> On Aug 24, 2007, at 11:36 AM, jai-imageio@javadesktop.org wrote:
>
>> So in reviewing this thread it appears that everything has been covered by
>> the jai-imageio issues 14, 17, 18 , and 19, is that correct?
>>
>> Brian
>> [Message sent by forum member 'bpb' (bpb)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=232518

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Nidel, Mike

According to the javadoc for J2KImageWriteParam found at

the encoding rate is defined as:

"The bitrate in bits-per-pixel for encoding. Should be set when lossy
compression scheme is used. With the default value Double.MAX_VALUE, a
lossless compression will be done."

I see that you are multiplying your number by Double.MAX_VALUE. I don't
think this will work, as you have observed. Instead, why don't you take
the bits-per-pixel of your original uncompressed image (probably 8 or
16), and multiply THAT by the number?

Perhaps as a test you should try something such as 2, 3, or 4 bits per
pixel.

> -----Original Message-----
> From: jai-imageio@javadesktop.org
> [mailto:jai-imageio@javadesktop.org]
> Sent: Wednesday, August 15, 2007 12:40 PM
> To: interest@jai-imageio.dev.java.net
> Subject: [JAI-IMAGEIO] poor JPEG2000 image quality with
> setEncodingRate
>
> JPEG2000 image quality is good only with
> setEncodingRate(Double.MAX_VALUE) or lossless.
> When setEncodingRate(Double.MAX_VALUE*number), where number
> is from 0.01 to 0.99, the image quality is very poor and
> there is no difference between different encoding rate.
> Is there any more parameters need to set?
>
> Thanks.
> [Message sent by forum member 'jiezhang' (jiezhang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=230979
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

jiezhang
Offline
Joined: 2005-12-29
Points: 0

I did try some integer number in setEncodingRate but they did not work.
I tried with 2, 4, 8, 16. With these numbers the image content was totally lost and whole image became black.
It is very confusing why bits-per-pixel is a double value.

Nidel, Mike

I understand that it's not intuitive that bits per pixel should be a
double value, but this has to do with the underlying image science of
the compression. You can think of it more as an "average" bits per
pixel. As you know, images compressed with certain techniques can vary
greatly in size even when applying the same compression. Part of this
has to do with the fact that the compressed size of the data is
content-dependent.

I'm not sure why the integer numbers you passed in didn't work. I can't
help you there. Maybe there is a type conversion problem, I assume you
tried 2.0, 4.0, 8.0, 16.0? My experience with the JAI ImageIO JPEG2000
plugins is limited. There are two plugins -- one that is part of the
native library (CLib) and one that is pure java. You can disable the
CLib one by removing or renaming the clib_jii.dll or .so file
temporarily to see if there is a difference between the behavior of the
native and the pure java encoders.

> -----Original Message-----
> From: jai-imageio@javadesktop.org
> [mailto:jai-imageio@javadesktop.org]
> Sent: Wednesday, August 15, 2007 1:09 PM
> To: interest@jai-imageio.dev.java.net
> Subject: Re: RE: [JAI-IMAGEIO] poor JPEG2000 image quality
> with setEncodingRate
>
> I did try some integer number in setEncodingRate but they did
> not work.
> I tried with 2, 4, 8, 16. With these numbers the image
> content was totally lost and whole image became black.
> It is very confusing why bits-per-pixel is a double value.
> [Message sent by forum member 'jiezhang' (jiezhang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=230985
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net