Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File newFile = null;
- BufferedImage oldImage = null;
- BufferedImage newImage = null;
- String fileName = new String((args[0]));
- String newFileName = new String(fileName.replaceFirst(".png", "-tiled.png"));
- try{
- oldImage = ImageIO.read(new File(fileName));
- System.out.println("Reading Complete");
- }
- catch(IOException e) {
- System.out.println("Error: "+ e);
- }
- int width = oldImage.getWidth();
- int height = oldImage.getHeight();
- newImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
- int imagePixels [][] = new int [height][width];
- for (int i = 0; i < height -1; ++i) {
- for (int j = 0; j < width - 1; ++j) {
- imagePixels[i][j] = oldImage.getRGB(i,j); //error here
- }
- }
- "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
- at sun.awt.image.ByteInterleavedRaster.getDataElements(Unknown Source)
- at java.awt.image.BufferedImage.getRGB(Unknown Source)
- at imagery.ImageTiler.main(ImageTiler.java:35)
- for (int i = 0; i < width -1; ++i) {
- for (int j = 0; j < height - 1; ++j) {
- imagePixels[i][j] = oldImage.getRGB(i,j); //error here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement