Re: ImageIO.write can't create a JPEG nor PNG
- From: Nigel Wade <nmw@xxxxxxxxxxxx>
- Date: Thu, 23 Nov 2006 09:36:06 +0000
hundredandten@xxxxxxxxx wrote:
i have a BufferedImage that I am writing into a JPEG file. I don't get
any errors, but the file doesn't seem to be created.
i'm doing this:
try {
if (img == null) System.out.println("failed!!");
File file = File.createTempFile("rubbish","jpg");
ImageIO.write(img, "jpg", file);
} catch(IOException e) {
System.out.println("failed:(");
}
but I check in the local directory where I am running the program and
nothing gets created
Perhaps you should read the documentation for File.createTempFile(). It's always
a good idea to read docs. to find out what a method does, before using it and
getting surprised because it doesn't do what you *assumed* it would. Look in
the correct directory and you might find your missing file.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@xxxxxxxxxxxx
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
.
- References:
- ImageIO.write can't create a JPEG nor PNG
- From: hundredandten
- ImageIO.write can't create a JPEG nor PNG
- Prev by Date: Re: JTree and XML
- Next by Date: Re: JTree and XML
- Previous by thread: ImageIO.write can't create a JPEG nor PNG
- Index(es):