public BufferedImage crop(int x, int y, int height, int width) {
        //Outside of image
        if (x > img.getWidth() || y > img.getHeight())
            return null;

        if (height + y > img.getHeight())
            height = img.getHeight() - y;

        if (width + x > img.getWidth())
            width = img.getWidth() - x;

        return img.getSubimage(x, y, width, height);
    }