@Override
    public LuminanceSource rotateCounterClockwise45() {
        int width  = getWidth();
        int height = getHeight();

        int oldCenterX = left + width / 2;
        int oldCenterY = top + height / 2;

        // Rotate 45 degrees counterclockwise.
        AffineTransform transform = AffineTransform.getRotateInstance(MINUS_45_IN_RADIANS, oldCenterX, oldCenterY);

        int           sourceDimension = Math.max(image.getWidth(), image.getHeight());
        BufferedImage rotatedImage    = new BufferedImage(sourceDimension, sourceDimension, BufferedImage.TYPE_BYTE_GRAY);

        // Draw the original image into rotated, via transformation
        Graphics2D g = rotatedImage.createGraphics();
        g.drawImage(image, transform, null);
        g.dispose();

        int halfDimension = Math.max(width, height) / 2;
        int newLeft       = Math.max(0, oldCenterX - halfDimension);
        int newTop        = Math.max(0, oldCenterY - halfDimension);
        int newRight      = Math.min(sourceDimension - 1, oldCenterX + halfDimension);
        int newBottom     = Math.min(sourceDimension - 1, oldCenterY + halfDimension);

        return new BufferedImageLuminanceSource(rotatedImage, newLeft, newTop, newRight - newLeft, newBottom - newTop);
    }
This is always true, since the image is a gray-scale image.

@return true
src/main/java/io/github/biezhi/wechat/utils/BufferedImageLuminanceSource.java