public static BufferedImage rotatePicture(BufferedImage originalImage, int rotationDegree) {
        Logger.getLogger(ImageReader.class.getName()).entering(ImageReader.class.getName(), "rotatePicture", new Object[] {originalImage, rotationDegree});
        if (originalImage != null) {
            BufferedImage rotatedBufferedImage;
            if(rotationDegree == 180) {
                rotatedBufferedImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
            } else if (rotationDegree == 90 || rotationDegree == 270) {
                rotatedBufferedImage = new BufferedImage(originalImage.getHeight(), originalImage.getWidth(), BufferedImage.TYPE_INT_ARGB);
            } else if (rotationDegree == 0) {
                return originalImage;
            } else {
                Logger.getLogger(ImageReader.class.getName()).log(Level.WARNING, "The rotation wanted have not been found", rotationDegree);
                Logger.getLogger(ImageReader.class.getName()).exiting(ImageReader.class.getName(), "rotatePicture", null);
                return null;
            }
            Graphics2D g2d = rotatedBufferedImage.createGraphics();
            g2d.rotate(Math.toRadians(rotationDegree), 0, 0);
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
            g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
            g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
            if (rotationDegree == 180) {
                g2d.drawImage(originalImage, -originalImage.getWidth(), -originalImage.getHeight(), originalImage.getWidth(), originalImage.getHeight(), null);
            }
            else if (rotationDegree == 90) {
                g2d.drawImage(originalImage, 0, -originalImage.getHeight(), originalImage.getWidth(), originalImage.getHeight(), null);
            }
            else if (rotationDegree == 270) {
                g2d.drawImage(originalImage, -originalImage.getWidth(), 0, originalImage.getWidth(), originalImage.getHeight(), null);
            }
            g2d.dispose();
            originalImage.flush();
            Logger.getLogger(ImageReader.class.getName()).exiting(ImageReader.class.getName(), "rotatePicture", rotatedBufferedImage);
            return rotatedBufferedImage;
        }
        Logger.getLogger(ImageReader.class.getName()).exiting(ImageReader.class.getName(), "rotatePicture", null);
        return null;
    }