JPEG Image writer problem

K

Kurt M Peters

When I try to use the code below on a machine the software was developed on,
the code cannot find the following file (which should be a "standard" java
color profile in the local cmm directory. Does anyone have a clue what I'm
doing wrong?

Regards,
Kurt
::::::::::::::: Code to save JPEG ::::::::::::::::::::::
public void writejpeg(BufferedImage outIm) {//BufferedImage bi) {
if (outIm == null) {
JOptionPane.showMessageDialog(this, "Cannot write file.\nThere
is no image to save.","File Write Problem",JOptionPane.WARNING_MESSAGE);
return;
}
jFCchooser.setDialogTitle("Save Image");
ImageOutputStream ios = null;

int returnVal = jFCchooser.showSaveDialog(this);
Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
ImageWriter writer = (ImageWriter)writers.next();
ImageWriteParam param = writer.getDefaultWriteParam();
Float quality = new Float(1.0);
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
param.setCompressionQuality(1.0f);

// ImageIO.write(myImage, "jpg", imageFile);
if(returnVal == JFileChooser.APPROVE_OPTION) {

IIOParamController controller = param.getController();
if (controller != null) {
controller.activate(param);
}

try {
ios =
ImageIO.createImageOutputStream(jFCchooser.getSelectedFile());
} catch (IllegalArgumentException ia){
System.err.println("IllegalArgumentException - if output is
null. ");
} catch (IOException IOe) {
System.err.println("a cache file is needed but cannot be
created.");
}
writer.setOutput(ios);
try {
writer.write(null, new IIOImage(outIm,null,null), param);
} catch (IllegalStateException IE) {
System.err.println("The output has not been set.");
} catch (IllegalArgumentException IAE){
System.err.println("Image is null.");
} catch (IOException IOe){
System.err.println("An error occured during writing.");
}
writer.dispose();
try {
ios.close();
} catch (IOException e){

}
}

}
 
R

Roedy Green

When I try to use the code below on a machine the software was developed on,
the code cannot find the following file (which should be a "standard" java
color profile in the local cmm directory. Does anyone have a clue what I'm
doing wrong?

what exactly did it say?

What do you mean "following file"
 
R

Roedy Green

The file is: PYCC.pf. Sorry.

What did the error message say exactly. Please do not paraphrase. The
key may be in the details of that error message.
 
R

Roedy Green

the file belongs in C:\Program Files\Java\jre1.5.0_05\lib\cmm\PYCC.pf
and also
E:\Program Files\Java\jdk1.5.0_05\jre\lib\cmm\PYCC.pf

If it is not there, you probably have other damage as well.

I suggest uninstalling all JAVA and manually deleting the java
directories.

To be really sure wipe out all traces of JAVA from the registry too.
See http://mindprod.com/jgloss/registry.html

Then reinstall JDK 1.5.0_05.

Then test your JRE. See http://mindprod.com/jgloss/jre.html#TESTING

If the file is there, try testing your JRE. You may have have two JVMs
installed which are interfering with each other.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top