public double loadImage(String file) {
        global = GlobalMode.EditMode;
        //setEdit();
        lb.drawMode();
        image = null;
        this.scale = 1;
        try {
            image = ImageIO.read(new File(file));
        } catch (IOException e) {
            System.out.println("Error Opening File: " + e.getMessage());

        }
        if (image == null) {
            return 1;
        }
        if (image.getWidth() > 800 || image.getHeight() > 600) {
            int newWidth = image.getWidth() > 800 ? 800 : (image.getWidth() * 600) / image.getHeight();
            int newHeight = image.getHeight() > 600 ? 600 : (image.getHeight() * 800) / image.getWidth();
            System.out.println("SCALING TO " + newWidth + "x" + newHeight);
            double scale = (double) newWidth / (double) image.getWidth();
            Image scaledImage = image.getScaledInstance(newWidth, newHeight, Image.SCALE_FAST);
            image = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
            image.getGraphics().drawImage(scaledImage, 0, 0, this);
            this.scale = scale;
            return scale;
        }
        return 1;
    }