Skip to main content

jpeg-lossless

1 reply [Last post]
0315
Offline
Joined: 2008-12-04
Points: 0

hi,

I downloaded losslessly compressed jpeg from http://marathon.csee.usf.edu/Mammography/Database.html
Now I`m trying to show what is on this image but when I read it there seems to be something wrong.
I have the same problem that someone had here:
http://markmail.org/message/b25kkdx267qcg52c#query:java%20jai%20lossless...

take a look into correct.jpg and yours.jpg.

on my image I also have gradiented triangle on the image.

Here is my code:

***************** code ******************
package test;

import java.awt.image.BufferedImage;
import java.awt.image.renderable.ParameterBlock;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;

import com.sun.media.jai.widget.DisplayJAI;
import javax.swing.*;
import javax.media.jai.*;
import javax.media.jai.operator.ScaleDescriptor;
import javax.imageio.*;
import javax.imageio.stream.FileImageOutputStream;

public class TestViewer3 extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JScrollPane imageScroll = null;
public DisplayJAI imagePanel = null;
public PlanarImage planImg = null;

public TestViewer3(String filename) {
try {
java.util.Iterator losslessJPEGReaders = ImageIO
.getImageReadersByFormatName("jpeg-lossless");

ImageReader losslessJPEGReader = null;

if (losslessJPEGReaders.hasNext()) {
losslessJPEGReader = (ImageReader) losslessJPEGReaders.next();
} else {
throw new UnsupportedOperationException(
"No lossless JPEG readers available!");
}

ParameterBlockJAI pbJAI = new ParameterBlockJAI("ImageRead");

pbJAI.setParameter("Input", filename);

pbJAI.setParameter("Reader", losslessJPEGReader);
planImg = JAI.create("ImageRead", pbJAI);

RenderedOp renderedOp = ScaleDescriptor.create(planImg, new Float(
0.1f), new Float(0.1f), new Float(0.0f), new Float(0.0f),
Interpolation.getInstance(Interpolation.INTERP_BICUBIC),
null);

imagePanel = new DisplayJAI();
imageScroll = new JScrollPane(imagePanel);
getContentPane().add(imageScroll);
this.setTitle("Test Image");
this.setSize(500, 500);
this.setVisible(true);
imagePanel.set(renderedOp.getAsBufferedImage());
} catch (Exception ex) {
ex.printStackTrace();
}
}

public static void main(String[] args) {
TestViewer3 testViewer = new TestViewer3(
"A_0200_1.LEFT_CC.LJPEG");
}
}
***************** code end ******************

thx for any help
oen

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jxc
Offline
Joined: 2005-02-24
Points: 0

Hi,

Thanks for the test case. I could reproduce the problem, so I filed
this issue:

https://jai-imageio-core.dev.java.net/issues/show_bug.cgi?id=179

Thanks,
-James