public CropImage() throws IOException {
        int photoHeight;
        int photoWidth;
        int ret = fileopen.showDialog(null, "Open file");

        if (ret != JFileChooser.APPROVE_OPTION) {
            System.out.println("Did not select a file");
            System.exit(1);
        }
        File input  = fileopen.getSelectedFile();
        currentName = input.getAbsolutePath();
        image       = ImageIO.read(input);
        photoWidth  = image.getWidth();
        photoHeight = image.getHeight();
        if (!verifyDimensions(photoWidth, photoHeight)) {
            System.out.println(String.format("Dimensions %s not correct",
                                             currentName));
            System.exit(1);
        }
        imageWidth  = photoWidth  / resizeValue;
        imageHeight = photoHeight / resizeValue;
        setSize(imageWidth, imageHeight);
        imageInfo.setText(String.format( "Image size: %dx%d, displayed as: %dx%d",
                                         photoWidth, photoHeight,
                                         imageWidth, imageHeight));
        selectInfo.setText(String.format("Crop size: %dx%d, displayed as: %dx%d",
                                         cropWidth * resizeValue, cropHeight * resizeValue,
                                         cropWidth,               cropHeight));
        addMouseListener(new MouseListener() {
                @Override
                public void mouseReleased(MouseEvent e) {
                }
                @Override
                public void mousePressed(MouseEvent e) {
                }
                @Override
                public void mouseExited(MouseEvent e) {
                }
                @Override
                public void mouseEntered(MouseEvent e) {
                }
                @Override
                public void mouseClicked(MouseEvent e) {
                    x = (int) e.getPoint().getX() - cropWidth  / 2;
                    y = (int) e.getPoint().getY() - cropHeight / 2;
                    verifyXAndY();
                    repaint();
                }
            });
    }