//! An example of opening an image.
extern crate image;

use std::env;
use std::fs::File;
use std::path::Path;

use image::GenericImage;

fn main() {
    let file = if env::args().count() == 2 {
        env::args().nth(1).unwrap()
    } else {
        panic!("Please enter a file")
    };

    // Use the open function to load an image from a PAth.
    // ```open``` returns a dynamic image.
    let im = image::open(&Path::new(&file)).unwrap();

    // The dimensions method returns the images width and height
    println!("dimensions {:?}", im.dimensions());

    // The color method returns the image's ColorType
    println!("{:?}", im.color());

    let ref mut fout = File::create(&Path::new(&format!("{}.png", file))).unwrap();

    // Write the contents of this image to the Writer in PNG format.
    let _ = im.save(fout, image::PNG).unwrap();
}

//! An example of opening an image.
extern crate image;

use std::env;
use std::fs::File;
use std::path::PathBuf;

use image::GenericImage;

fn main() {
    let file = if env::args().count() == 2 {
        env::args().nth(1).unwrap()
    } else {
        panic!("Please enter a file")
    };

    // Use the open function to load an image from a PAth.
    // ```open``` returns a dynamic image.
    let im = image::open(&PathBuf::new(file.clone())).unwrap();

    // The dimensions method returns the images width and height
    println!("dimensions {:?}", im.dimensions());

    // The color method returns the image's ColorType
    println!("{:?}", im.color());

    let ref mut fout = File::create(&PathBuf::new(format!("{}.png", file))).unwrap();

    // Write the contents of this image to the Writer in PNG format.
    let _ = im.save(fout, image::PNG).unwrap();
}

--- 
+++ 
@@ -3,7 +3,7 @@
 
 use std::env;
 use std::fs::File;
-use std::path::Path;
+use std::path::PathBuf;
 
 use image::GenericImage;
 
@@ -16,7 +16,7 @@
 
     // Use the open function to load an image from a PAth.
     // ```open``` returns a dynamic image.
-    let im = image::open(&Path::new(&file)).unwrap();
+    let im = image::open(&PathBuf::new(file.clone())).unwrap();
 
     // The dimensions method returns the images width and height
     println!("dimensions {:?}", im.dimensions());
@@ -24,7 +24,7 @@
     // The color method returns the image's ColorType
     println!("{:?}", im.color());
 
-    let ref mut fout = File::create(&Path::new(&format!("{}.png", file))).unwrap();
+    let ref mut fout = File::create(&PathBuf::new(format!("{}.png", file))).unwrap();
 
     // Write the contents of this image to the Writer in PNG format.
     let _ = im.save(fout, image::PNG).unwrap();
Upgrade examples to latest rust
