Results 1 to 2 of 2
  1. #1
    reverton is offline Member
    Join Date
    Apr 2013
    Rep Power

    Default Read an image an write one back

    I am trying to read an image the I have already put in my package and then write another file with the same picture. There are no errors, but it is not writing the new file:
    Java Code:
    	public static void main(String[] args) {
    		try {
    			BufferedImage image = File("IMG_0146.jpg"));
    			ImageIO.write(image, "jpg", new File("uts.jpg"));
    		} catch (IOException e) {
    Last edited by JosAH; 05-11-2013 at 11:40 AM. Reason: fixed the [code] ... [/code] tags

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: Read an image an write one back

    Create the File object first, and then print the value of getAbsolutePath().
    That will tell you (at least) where it is going to try and save the image.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. XML read/write in Java
    By bogdy.laurentiu in forum XML
    Replies: 5
    Last Post: 05-31-2010, 06:08 PM
  2. Read/Write Files
    By FlyNn in forum New To Java
    Replies: 3
    Last Post: 02-06-2010, 08:45 PM
  3. How to read first 9 bytes and write in...?
    By aRTx in forum New To Java
    Replies: 8
    Last Post: 03-26-2009, 02:54 PM
  4. Saved files are coming back as read-only
    By Manoeuvre in forum Eclipse
    Replies: 0
    Last Post: 11-21-2008, 05:18 PM
  5. Read and Write file
    By mrdestroy in forum New To Java
    Replies: 13
    Last Post: 10-31-2008, 12:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts