private double getAngle(Path sourceFile, Metadata metadata) throws IOException {
        BufferedImage bi = ImageIO.read(sourceFile.toFile());
        ImageDeskew id = new ImageDeskew(bi);
        double angle = id.getSkewAngle();

        if (angle < MINIMUM_DESKEW_THRESHOLD && angle > -MINIMUM_DESKEW_THRESHOLD) {
            LOG.debug("Changing angle " + angle + " to 0.0");
            angle = 0d;
        } else {
            metadata.add(TesseractOCRParser.IMAGE_ROTATION,
                    String.format(Locale.getDefault(), "%.3f", angle));
        }

        return angle;
    }
Get the current skew angle of the image.  Positive = clockwise; Negative = counter-clockwise
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/ImagePreprocessor.java