Created
April 18, 2017 13:29
-
-
Save Visgean/0aa73e5e97f2b21f746b958e7e579ba2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import java.io.IOException; | |
import javax.imageio.ImageIO; | |
public class Main { | |
public static void main(String[] args) { | |
if (args.length == 0) { | |
System.out.println("Yo man. Give me filename."); | |
System.exit(1); | |
} | |
try | |
{ | |
// the line that reads the image file | |
BufferedImage image = ImageIO.read(new File(args[0])); | |
// work with the image here ... | |
} | |
catch (IOException e) | |
{ | |
System.out.println("Image not found."); | |
System.exit(1); | |
} | |
System.out.printf("Image resolution %dx%d", image.getWidth(), image.getWidth()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import java.io.IOException; | |
import javax.imageio.ImageIO; | |
public class Main { | |
public static void main(String[] args) { | |
if (args.length == 0) { | |
System.out.println("Yo man. Give me filename."); | |
System.exit(1); | |
} | |
try | |
{ | |
// the line that reads the image file | |
BufferedImage image = ImageIO.read(new File(args[0])); | |
// work with the image here ... | |
System.out.printf("Image resolution %dx%d", image.getWidth(), image.getWidth()); | |
} | |
catch (IOException e) | |
{ | |
System.out.println("Image not found."); | |
System.exit(1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment