DFT problem in JAI
Hello!
I have a strange problem with the JAI classes that perform DFT and IDFT. I perform both the operations on an image but the result I get is not the original image. What 's wrong with my code?
Thanks for the help.
My code is as follows
import javax.media.jai.*;
import javax.media.jai.operator.*;
import java.awt.image.renderable.*;
import java.awt.image.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.color.*;
import javax.swing.*;
import com.sun.image.codec.jpeg.*;
import java.awt.RenderingHints;
public class dftchain extends JPanel{
PlanarImage img1;
PlanarImage img2;
PlanarImage finim;
BufferedImage im;
ImagePanel viewer;
public static void main(String[] args) {
dftchain s = new dftchain();
public dftchain() {
Image im1= readImage("ref.jpg");
img1 = JAI.create("awtimage", im1);
PlanarImage gray1 = convertColorToGray(img1,30);
RenderedOp rop1 = DFTImage(gray1, DFTDescriptor.SCALING_NONE, DFTDescriptor.REAL_TO_COMPLEX);
RenderedOp mag = magnitudeImage(rop1);
RenderedOp refphase = phaseImage(rop1);
RenderedOp complex = polarToComplexImage(mag, refphase);
PlanarImage finim = inverseDFTImage(complex,DFTDescriptor.SCALING_NONE, DFTDescriptor.COMPLEX_TO_REAL);
im = finim.getAsBufferedImage();
diplay(im);
public RenderedOp DFTImage (PlanarImage image, DFTScalingType scalingType, DFTDataNature dataNature){
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
pb.add(scalingType).add(dataNature);
return JAI.create("dft",pb);
public RenderedOp inverseDFTImage (PlanarImage image, DFTScalingType scalingType, DFTDataNature dataNature) {
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
pb.add(scalingType).add(dataNature);
return JAI.create("idft", pb);
public RenderedOp magnitudeImage (PlanarImage image){
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
return JAI.create("magnitude",pb);
public RenderedOp phaseImage (PlanarImage image){
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
return JAI.create("phase",pb);
public RenderedOp polarToComplexImage( RenderedOp mag, RenderedOp phase) {
ParameterBlock pb = new ParameterBlock();
pb.addSource(mag);
pb.addSource(phase);
return JAI.create("polartocomplex", pb);
public void diplay (BufferedImage img) {
int width = img.getWidth();
int height = img.getHeight();
JFrame fr = new JFrame();
fr.addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e){
System.exit(0);
fr.setTitle("Viewer");
viewer = new ImagePanel(img);
viewer.setPreferredSize(new Dimension(width,height));
Container cp = fr.getContentPane();
fr.getContentPane().setLayout(new GridLayout(1,1));
cp.add(viewer);
fr.pack();
fr.getSize(new Dimension(width, height));
fr.show();
viewer.repaint();
public Image readImage(String imageName) {
Image image = Toolkit.getDefaultToolkit().getImage(imageName);
MediaTracker imageTracker = new MediaTracker(this);
imageTracker.addImage(image,0);
try{
imageTracker.waitForID(0);
catch (InterruptedException e) {
System.out.println(e);
return image;
// produce a 3 band luminance image from a 3 band color image */
public PlanarImage convertColorToGray(PlanarImage src, int brightness) {
PlanarImage dst = null;
double b = (double) brightness;
double[][] matrix = {
{ .114D, 0.587D, 0.299D, b },
{ .114D, 0.587D, 0.299D, b },
{ .114D, 0.587D, 0.299D, b }
if ( src != null ) {
ParameterBlock pb = new ParameterBlock();
pb.addSource(src);
pb.add(matrix);
dst = JAI.create("bandcombine", pb, null);
return dst;
class ImagePanel extends JComponent {
BufferedImage image;
public ImagePanel (BufferedImage img) {
image = img;
public void paintComponent(Graphics g) {
Rectangle rect = this.getBounds();
if (image!=null){
g.drawImage(image,0,0,rect.width,rect.height,this);
}
I am not saying it will work, but I would ask if you tried "Dilate"? I don't know what the parameters are supposed to be for the different methods, but I do know how to get a listing of them. See the code below:
OperationRegistry ory = JAI.getDefaultInstance().getOperationRegistry();
String [] temp = ory.getRegistryModes();
String []temp2;
for (int which = 0; which < temp.length; which++) {
temp2 = ory.getDescriptorNames(temp[which]);
System.out.println("\t"+temp[which]+":");
for (int cual = 0; cual < temp2.length; cual++) {
System.out.println("\t\t"+temp2[cual]);
That will get you a listing of all of the registry modes and the descriptor names within each mode. For parameters and explanations, well, I guess check out the source code for the JAI library and then rifle through it until you find an example, or use trial-and-error, since the only documentation seems to refer to deprecated calls (as I have noted in the most recent version of JAI).
Similar Messages
-
Image border problem using JAI
I've written some very simple code to scale an image down to a small
thumbnail in JPG format but the quality is quite horrible. Is there a way of making it look nicer?
src = JAI.create("fileload","filepath")
ParameterBlock params = new ParameterBlock();
params.addSource(src);
params.add(xScale);//x scale factor
params.add(yScale);//y scale factor
params.add(0.0F);//x translate
params.add(0.0F);//y translate
params.add(Interpolation.getInstance(Interpolation.INTERP_NEAREST));
dest = JAI.create("scale", params,null);
I switched to InterpolationBicubic, instead of Interpolationnearest the quality was much better but the resulting image contained borders.
could some one tell me is there any other way to get better and nicer results.Yes you can fix the border problem by setting a render hint to change the way the borders are handled. Something like the following will do the trick.
You can also use BORDER_WRAP instead of BORDER_COPY, both seem to have a similar result. Mind you I am still very dissapointed with the quality of the bicubic resampling in JAI, but at least this will fix the problem with the borders.
RenderingHints rh = new RenderingHints(JAI.KEY_BORDER_EXTENDER, BorderExtender.createInstance(BorderExtender.BORDER_COPY));
dest = JAI.create("scale", params,rh); -
the line code is
input = JAI.create("fileload",file);
when i compile my project there is no problem but when i run it i have this error
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at algorithms.fuzzycmeans.FuzzyCMeansImageClusteringApp.main(FuzzyCMeansImageClusteringApcan you telle me what is the problemThanks both for answering!!!
yes I agree with The fiscal periods could be different systems, but documents were created as PRD case, same month and year.
where could I check "Fiscal Year variant" ( If you are not talking about program variant ).
Guys, I was debugging and I check that exactly on GET BKPF ( is like a loop ) for my document 1600003538 bkpf-monat = 03, but suddenly in GET instruction with another document 1700003522 bkpf-monat = 01
and this is the value printed
document = 1600003538 .
monat = 01 ( must be monat = 03).
I really appreciate your answer, thanks. -
Hi,
Having trouble using JAI. It's VERY new to me and I don't know how to fix the problem I'm encountering.
I've pasted the stack trace that I get when I run my code.
Is the problem related to my code or does it have something to do with where my classes are located? If it's because it can't find the class path, what do I do to make sure it finds the class path?
Thank you.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/jai/OperationRegistrySpi
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.sun.media.jai.util.Service$LazyIterator.next(Service.java:268)
at javax.media.jai.OperationRegistry.registerServices(OperationRegistry.java:2055)
at javax.media.jai.ThreadSafeOperationRegistry.registerServices(ThreadSafeOperationRegistry.java:620)
at javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:373)
at javax.media.jai.JAI.<clinit>(JAI.java:566)
at Forms.main(Forms.java:100)If you have installed it into the right JDK-directory, there should be a file jai_core.jar in your <JAVA_HOME>/jre/lib/ext directory and the jar is automatically recognized by java. To exclude the case, where the wrong JDK is used, you can include this file and all other files in the directory, which contain "jai" in there file-name, in your classpath.
-
Hi All, I am trying to use JAI to build a histogram of an image i have. I have posted the code below, and the error I get at runtime. I have taken the code from the offical java examples, so I am really puzzled why it doesn't work
public PlanarImage thresholding (PlanarImage source) {
// set up the histogram
int[] bins = { 256 };
double[] low = { 0.0D };
double[] high = { 256.0D };
Histogram histogram = new Histogram(bins, low, high);
ParameterBlock pb2 = new ParameterBlock();
pb2.addSource(source);
pb2.add(histogram);
pb2.add(null);
pb2.add(1);
pb2.add(1);
RenderedOp op = JAI.create("histogram", pb2, null);
histogram = (Histogram) op.getProperty("histogram");
// get histogram contents
int[] local_array = new int[histogram.getNumBins(0)];
for ( int i = 0; i < histogram.getNumBins(0); i++ ) {
local_array[i] = histogram.getBinSize(0, i);
System.out.println("No Of Bins:- "+local_array) ;
ParameterBlock pb = new ParameterBlock();
low[0] = 0.0F;
high[0] = 106.0F;
pb.addSource(source);
pb.add(low);
pb.add(high);
pb.add(map);
target = JAI.create("threshold", pb, null);
display.set(target);
return target ;The code above provides the solution.
The histogram operation, like most other JAI operations, requires
a ParameterBlock as its argument. The parameterBlock contains the
arguments needed to perform the operation.
The histogram operation requires the ParameterBlock to contain the
arguments shown in the previous post (6 arguments). To obtain a
parameterBlock that contains the default arguments for the operation
you create ParameterBlockJAI with the operation name. This gives you
a ParameterBlock with the default arguments.
If you want to modify the arguments you call the methods on the
ParameterBlock(JAI) to set them.
you then use the utility methods supplied in the JAI class to create
the operation.
String operation = "Histogram";
ParameterBlockJAI paramBlock = new ParameterBlockJAI(operation);
// modify parameterblock here
RenderedOp op = JAI.create(operation,paramBlock);matfud -
Problem with JAI medialib accelorator
I use JAI to display images. Recently after loading an IBM Websphere product my Java 1.4.0 programs(which have nothing to do with Websphere) started displaying this message in the command window:
Could not load mediaLib accelerator wrapper classes. Continuing in pure Java mode.The program continues to work after displaying this message.
I presume that the IBM stuff stepped on something but I can't figure out what it was.
Does anyone have any ideas?
Thanks
Bill BlalockI would bet your ibm product has replaced your jre or
is at least making java process with its jre until it
cannot figure out what to do, then it allows the
regular jre to do the work.I thought of that. To get around that I
- set the PATH to include the Sun Java, leave out the IBM stuff
- delete the CLASSPATH environment variable
- use -classpath option of java.exe for each execution
Can you think of something I missed? -
I am using scale method for Zooming purpose.So i set scale factor as 0.5 for Zoom-in and 1 for Zoom-out.First I load the image,then i perform Zoom-in to make fit width.After Zoom-in,i am getting the image co-ordinates which is totally different from that of original.But actually what I need is the image co-ordinates to be same when i Zoom-in or Zoom-out. So i think Scale in JAI is only for Resize and not for Zoom.So please provide me the solution for Zooming as early as possible.
Thanking You,
KannanI am not saying it will work, but I would ask if you tried "Dilate"? I don't know what the parameters are supposed to be for the different methods, but I do know how to get a listing of them. See the code below:
OperationRegistry ory = JAI.getDefaultInstance().getOperationRegistry();
String [] temp = ory.getRegistryModes();
String []temp2;
for (int which = 0; which < temp.length; which++) {
temp2 = ory.getDescriptorNames(temp[which]);
System.out.println("\t"+temp[which]+":");
for (int cual = 0; cual < temp2.length; cual++) {
System.out.println("\t\t"+temp2[cual]);
That will get you a listing of all of the registry modes and the descriptor names within each mode. For parameters and explanations, well, I guess check out the source code for the JAI library and then rifle through it until you find an example, or use trial-and-error, since the only documentation seems to refer to deprecated calls (as I have noted in the most recent version of JAI). -
Hi
I have installed JAI and included the .zip and .jai files in the classpath, but the JAI ImageReaders havn't got registered with ImageIO.
Without JAI:
code:
Iterator<ImageReader> iterator=ImageIO.getImageReadersBySuffix("jpg");
while(iterator.hasNext()){
ImageReader reader=iterator.next();
System.out.println("Reader " + reader.getClass().getName() + "\n" + (reader.readerSupportsThumbnails()?"does ":"doesn't ") + "support thumbnails");
output:
Reader com.sun.imageio.plugins.jpeg.JPEGImageReader
does support thumbnails
It says it does support thumbnails, but I'm still not able to read any.
With JAI
commandline:
java -classpath jai-1_1_3-lib.zip:jai_codec.jar:jai_core.jar:. classfile
output:
Reader com.sun.imageio.plugins.jpeg.JPEGImageReader
does support thumbnails
I get the same ImageReader that I had previously! This ImageReader says it can read thumbnails, but it doesn't actually. I want an ImageReader that can read thumbnails, ie. I don't want "com.sun.imageio.plugins.jpeg.JPEGImageReader" but something else.
Does anyone know how to install JAI properly, I mean does anyone know how to get new pluggin ImageReaders from JAI registered with ImageIO? My images do have thumbnails, I'm just trying to read them.The JAI-ImageIO package dosen't have its own JPEG image reader, so you'll still get the com.sun.imageio.plugins.jpeg.JPEGImageReader one. My recomendation for the ImageIO library was only because you said you wanted to support a few more image formats.
While JAI core does have it's own JPEG "codec", I don't think JAI supports extracting information from an image's metadata. JAI is more about manipulating the core image, not about the finer details of a file's header.
Lastly, in the code I posted in the previous post I made a fairly significant blunder.
if (reader.readerSupportsThumbnails()) {
}That if statement should have a not equals (!) exclamation mark. If you used my code then you probably kept getting "Image format does not support thumnails" when it does.
So the question then is whether the standard JPEGImageReader correctly reads thumnail data. Here's my story of trying to answer that question:
I googled for some programs for which I could insert a thumnail in the JPEG's metadata. The programs that came up were really old, but I used one of them. When I tried reading the embeded jpg thumnail from java I got an Exception stating that the thumnail was not a JFIF image. Basically, the first version of JPEG had some shortcommings. What's now used by pretty much everyone and everything is JPEG File Interchange Format or JFIF for short. To remedy the situation I needed a newer program to insert the thumnail.
After googling some more, I learned that when saving an image as JPEG in Adobe Photoshop that little checkbox called "Preview" will attach a thumnail to the JPEG's metadata. I was able to confirm visually with the older program that this worked (that Adobe Photoshop inserted a thumnail). Going back to java, when I tried to read the thumnail - lo and behold - JPEGImageReader did not see the thumnail . When I look at the source code of JPEGImageReader it looks like it does make an attemp at looking for a thumnail. Obviously, something went wrong though. I don't know whether the JPEGImageReader is picky or it just dosen't see the thumnails, but in either case this is probably a bug. A quick bug search shows there is are several bugs related to JPEGImageReader and thumnails.
At this point all I can recommend is that if you want to load embeded jpg thumnail data through java you will need to google search for 3rd party jpeg image readers. You won't find a different JPEGImageReader in JAI-ImageIO or JAI.
As for the classpath thing you're suppose to set it on the Manifest File of your program, not the one that appears in the jdk or jre folder. -
Hi
We are facing a strange problem with graphs in BeX.
We are making graph on summarized data and storing it in workbooks.The problem im facing is that whenever the query is refreshed the Graph gets scattered.for e.g X axis becomes Y and things like that,
pls share your experience and a way to fix this problem
JPJPhi jaya
thanks for your response
i shall try upgrading and also check the note,
Thanks
JP -
Problem interface having only target datastore without source
Hi,
I have created an interface,there is no source my target is oracle table.
This table is having columns like..
current_date,load_cycle_id etc.
For current date in mapping i wrote 'select sysdate from dual' or 'sysdate'
For load_cycle_id = database sequence is mapped like
<schemaname>.<seq_name>.nextval
But it is not working properly,
In the operator select query doesn't have the from clause table value because of this it is resulting in an error.I manually added dual in that it is working.
plz let me know how to create interface without source datastore and necessary setting required.
<schemaname>.<seq_name>.currval it is also not working,it is giving error like
"not defined in this session"
plz let me know how to solve these problems
Thanks,
Jai
and in one more interface if i want to use current value of the sequence i wroteI have created file_id_seq in database.
In my first interface i have only target datastore.I have two fileds,like
Load_cycle_id: Mapping--> <schema>.<seq_name>.nextval
log_date : Mapping--> sysdate
when I saw the query generated by the Odi in operator description tab
selec ..
from <table name is missing>
in from clause i manually added dual ,and restarted the session then it was done.
Its problem with query generated by the ODI.
I changed in mappin as "select sysdate from dual" like that still i didn't get.
After loading this interface by manually editing ,I created one more interface,
in that one more filed is there which requires current value of the sequence used in above interface.In mapping i wrote <schema>.<seq_name>.curr_val Its resulting in an error like "sequence current value is not defined in this current session"
plz help me
Jai -
New JAI tools GIFImageWriter -- losing color info
Hi --
I'm a newbie trying to take advantage of the new GIFImageWriter packaged in the JAI IIO tools distribution. I'm trying to use it to convert JPG to GIF. The problem is that my output file comes out as a bare black and white rendering. Can anyone spot my mistake in the following code? ( // lines are various options I've tried that have same effect)
Thanks!
David Lieberman
String inFilename = args[0];
String outFilename = args[1];
BufferedImage bImage1;
BufferedImage bImage2;
File fileIn = new File(inFilename);
File out = new File(outFilename);
bImage1 = ImageIO.read(fileIn);
//Color color = bImage1.createGraphics().getColor();
Color color = bImage1.getGraphics().getColor();
IndexColorModel colorModel = new IndexColorModel(8, 2,
new byte[]{(byte) (color.getRed() - 1), (byte) color.getRed()},
new byte[]{0, (byte) color.getGreen()},
new byte[]{0, (byte) color.getBlue()}, 0);
ColorConvertOp ccOp = new ColorConvertOp(bImage1.getColorModel().getColorSpace(), colorModel.getColorSpace(), null);
bImage2 = new BufferedImage(bImage1.getWidth(),
bImage1.getHeight(),
BufferedImage.TYPE_BYTE_INDEXED,
colorModel);
Graphics2D g2d = bImage2.createGraphics();
//g2d.drawImage(bImage1, 0, 0, bImage1.getWidth(), bImage1.getHeight(), null);
//g2d.drawRenderedImage(bImage1, null);
g2d.drawImage(bImage1, ccOp, 0,0);
ImageIO.write(bImage2, "gif", out);Hi David,
The main problem with JAI IIO GIFImageWriter is that it doesn't contain any color quantizer and as a result can't encode images with number of unique colors more then 256.
As I understand you've tried to to resample image's palette but I can't imagine where you've found such example: it's totally wrong. There are some special color quantization algorithms to reduce the number of unique colors such as Median-Cut, Octree etc. You can find their Java implementations (some of them open-source) using Google.
We use for this purposes the commercial solutions from Gif4J Software. If speed and quality is critical for you then try the Gif4J PRO Library (http://www.gif4j.com/java-gif-imaging-gif4j-pro-library.htm). It contains very fast and qualitative java color quantizer and also supports ImageIO API. The next example convert jpeg (or any other true-color format) to gif using Gif4J PRO library by 3 different ways:
import com.gif4j.GifEncoder;
import com.gif4j.quantizer.Quantizer;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class ImageIOExample {
public static void main(String[] args) {
try {
BufferedImage source = ImageIO.read(new File(args[0]));
// 1-st example:
// save as GIF using ImageIO (Gif4J jar should be in classpath)
// Gif4J Quantizer is used by default
ImageIO.write(source, "gif", new File(args[1]));
//2-nd example:
//Quantize image manually with the desired mode
BufferedImage quantized_1 =
Quantizer.quantize(Quantizer.MEMORY_NORMAL_OPTIMIZED_DITHER, source, 8);
ImageIO.write(quantized_1, "gif", new File(args[2]));
//3-d example:
// Use Gif4 GifEncoder instead of ImageIO and other quantization mode
BufferedImage quantized_2 =
Quantizer.quantize(Quantizer.MEMORY_NORMAL_FAST, source, 8);
GifEncoder.encode(quantized_2, new File(args[3]));
} catch (IOException e) {
e.printStackTrace();
} -
Bonjour jai un probleme depuis mon achat sur ebay le vendeur est crati've Us Je vous ecrit car je connais pas boucoup l'anglais le probleme est
- lorsque je je branche mes ?couteurs sur ma carte directment le son est imp?cable
2- lorsque je branche mes ?couteur sur le li've dri've le sound est distortionner et tres sacader je disais meme quil nest pas ?coutable
3- Mes driver son ajour
4- Jai tester sur un autre pc meme probleme
5- jai r?installer winxp sp2 et le meme probleme
6- D?brancher tout sur mon pc apart le disque C meme probleme
7- jouer avec tout les setup meme probleme
8- ce que jai remarquer lorsque je branche mes ?couteurs dans le li've dri've j'entend des petit parasite dasn mes ?couteur.. . pourtant avec le meme ?couteur le les memes Jack _ connection) jaipas de trouble sur ma chaine hi fi
PS je crois vraiment que le li've Dri've est d?fecteux et ca depuis mon achat il est maintenant temps pour vous de faire quelque chose car personne ne m?coute depuis mon achat ... Je croyais que le service ?tait beaucoup mieux !
Jespere que vous pouvez faire quelque chose pour moi...
Jai plus de 5 ans dexp?rience et cest vraiment le li've dri've !!!
MerciI've had the same problem for 3 months now, tried just about everything posted on this board and still can't get it to work. Creative really dropped the ball on this one, and they haven't even released a response to it yet as to my knowledge.
-
Aleatory One factory fails for the operation "encode"-JPEG
I've a very strange problem with JAI.write using JPEG, but is happening aleatory. Some times it works, some times I get the exception and some other times don't. What I've seen is that when I got first this error, then all the rest of the images throws it. I mean, I'm working OK and then I got the exception, from there, all the images, no matter that they were not trowing exceptions before, now they do, so I don't know what is happening. I'll post some code snippets and the full stack trace of the exception. Hope you can help me:
First, I have a class that is a JSP-Tag:
RenderedOp outputImage = JAI.create("fileload", imgFile.getAbsolutePath());
int widthSize = outputImage.getWidth();
int heightSize = outputImage.getHeight();
try{
outputImage.dispose();
}catch(Exception e){}
outputImage = null;That's the first thing, now, the second, this is a Servlet that writes the image to the browser (GetImageServlet its name, which appears in the stack trace):
FileSeekableStream fss = new FileSeekableStream(file);
RenderedOp outputImage = JAI.create("stream", fss);
int widthSize = outputImage.getWidth();
int heightSize = outputImage.getHeight();
if ((outputImage.getWidth() > 0) && (outputImage.getHeight() > 0)) {
if ((isThumbnail) && ((outputImage.getWidth() > 60) || (outputImage.getHeight() > 60))) {
outputImage = ImageManagerJAI.thumbnail(outputImage, 60);
} else if (outputRotate != 0) {
outputImage = ImageManagerJAI.rotate(outputImage, outputRotate);
OutputStream os = resp.getOutputStream();
resp.setContentType("image/jpeg");
ImageManagerJAI.writeResult(os, outputImage, "JPEG");
outputImage.dispose();
os.flush();
os.close();
outputImage = null;
imgFile = null;The code of ImageManagerJAI.writeResult, which is a method I use above:
public static void writeResult(OutputStream os, RenderedOp image, String type) throws IOException {
if ("GIF".equals(type)) {
GifEncoder encoder = new GifEncoder(image.getAsBufferedImage(), os);
encoder.encode();
} else {
JAI.create("encode", image, os, type, null);
}And the full exception trace is:
Error: One factory fails for the operation "encode"
Occurs in: javax.media.jai.ThreadSafeOperationRegistry
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
at javax.media.jai.JAI.createNS(JAI.java:1099)
at javax.media.jai.JAI.create(JAI.java:973)
at javax.media.jai.JAI.create(JAI.java:1668)
at com.syc.image.ImageManagerJAI.writeResult(ImageManagerJAI.java:27)
at GetImageServlet.doGet(GetImageServlet.java:214)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.sun.media.jai.codecimpl.util.ImagingException
at com.sun.media.jai.codecimpl.ImagingListenerProxy.errorOccurred(ImagingListenerProxy.java:63)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:280)
at com.sun.media.jai.opimage.EncodeRIF.create(EncodeRIF.java:70)
... 31 more
Caused by: com.sun.media.jai.codecimpl.util.ImagingException: IOException occurs when encode the image.
... 33 more
Caused by: java.io.IOException: reading encoded JPEG Stream
at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native Method)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:472)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:228)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:277)
... 32 more
javax.media.jai.util.ImagingException: All factories fail for the operation "encode"
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
at javax.media.jai.JAI.createNS(JAI.java:1099)
at javax.media.jai.JAI.create(JAI.java:973)
at javax.media.jai.JAI.create(JAI.java:1668)
at com.syc.image.ImageManagerJAI.writeResult(ImageManagerJAI.java:27)
at GetImageServlet.doGet(GetImageServlet.java:214)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
... 26 more
Caused by: com.sun.media.jai.codecimpl.util.ImagingException
at com.sun.media.jai.codecimpl.ImagingListenerProxy.errorOccurred(ImagingListenerProxy.java:63)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:280)
at com.sun.media.jai.opimage.EncodeRIF.create(EncodeRIF.java:70)
... 31 more
Caused by: com.sun.media.jai.codecimpl.util.ImagingException: IOException occurs when encode the image.
... 33 more
Caused by: java.io.IOException: reading encoded JPEG Stream
at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native Method)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:472)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:228)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:277)
... 32 more
Caused by:
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
at javax.media.jai.JAI.createNS(JAI.java:1099)
at javax.media.jai.JAI.create(JAI.java:973)
at javax.media.jai.JAI.create(JAI.java:1668)
at com.syc.image.ImageManagerJAI.writeResult(ImageManagerJAI.java:27)
at GetImageServlet.doGet(GetImageServlet.java:214)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.sun.media.jai.codecimpl.util.ImagingException
at com.sun.media.jai.codecimpl.ImagingListenerProxy.errorOccurred(ImagingListenerProxy.java:63)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:280)
at com.sun.media.jai.opimage.EncodeRIF.create(EncodeRIF.java:70)
... 31 more
Caused by: com.sun.media.jai.codecimpl.util.ImagingException: IOException occurs when encode the image.
... 33 more
Caused by: java.io.IOException: reading encoded JPEG Stream
at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native Method)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:472)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:228)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:277)
... 32 moreI'm using JDK 1.6, Tomcat 5.5, Windows XP, and JAI 1.1.2_01 (the jars are in the WEB-INF/lib of the project AND in the jdk 6/jre/lib/ext, while the dlls are only on jdk 6/jre/bin)
Please help, I don't know what to do, I've weeks with this problem. Dukes available pleaseeee!Hi
you can check if you get in the error logs an message like 'Could not load mediaLib accelerator wrapper classes. Continuing in pure Java mode.' may be the problem of JAI native accelerator -
Attendee is not available for business event
Dear all,
After business event sceduled i booked 9 attendees and i try to book one more attendee i am getting errorr message Attendee is not available for business event.
1. Attendee maintained in HR master data.
2. Org management is also maintained properly
3. Minimum capacity in business event is 15 maintained.
Still i am getting problem
Regards,
Jai Ram.Hi,
To day only i created a Business event the attendee is available for scheduled date.
and dates are ok but still i am getting this error only for particular person only..
and he is not schedule for different business event also for the same date.
Regards,
Jai Ram. -
I have a problem: when jai restore my iphone 4S it crashes at the end and I see an error 1
here is my log file:
update_baseband: querying baseband info
bbupdater: BEGIN: Querying info at stage first
bbupdater: BEGIN: Preparing
bbupdater: Requested boot mode: kBBUBootModeNone
bbupdater: Creating transport, attempts remaining 5...bbupdater: FAILED(kBBUReturnIOError)
bbupdater: Creating transport, attempts remaining 4...bbupdater: FAILED(kBBUReturnIOError)
bbupdater: Creating transport, attempts remaining 3...bbupdater: FAILED(kBBUReturnIOError)
bbupdater: Creating transport, attempts remaining 2...bbupdater: FAILED(kBBUReturnIOError)
bbupdater: Creating transport, attempts remaining 1...bbupdater: FAILED(kBBUReturnIOError)
bbupdater: Creating transport, attempts remaining 0...bbupdater: FAILED(kBBUReturnIOError)
bbupdater: END(kBBUReturnIOError): Preparing
bbupdater: END(kBBUReturnIOError): Querying info at stage first
send_bbupdate_status: sending baseband update status to host
update_baseband: bbupdater error: kBBUReturnIOError
0: RamrodErrorDomain/3ec: update_baseband: failed querying baseband info
1: BBUpdater/10
unable to convert ramrod error 1004
attempting to dump restore log
writing log file: /mnt1/restore.logThis is a Hardware error. Make an appointment at the Genuis Bar to resolve the problem. You can also try restoring without any sim card inside your phone. If it still gives this error, go ahead to the Genuis Bar.
Maybe you are looking for
-
Safari incredibly slow in loading pages on iMac
I am finding that my web pages are taking ages to load on my iMac but not the MacBook Pro
-
I am trying to add a pop-up warning when someone clicks on a link to leave the site. I work in a financial institution and it's required by the FDIC to have it. Any suggestions?
-
How do I get DVD's on to my library?
I just got a brand new 30G video Ipod and i cant figure out how to put DVDs on to my library and therefore to my ipod? Please help me!!!!!!!!
-
Want to put one track in iTunes before another (opening and closing)
I want to put two songs in order. The songs would make more sense if the opening of the song is first to be played before the end. Right now the songs are in like this end, then opening. Thanks in advance. Acer Windows XP Pro
-
hi, Button is inactive during the thread exection in jprogressbar.. can anybody shed some light on this... thnx in advance