Java 旋转90º;在JasperReports中的Blob图像中

Java 旋转90º;在JasperReports中的Blob图像中,java,image,jasper-reports,ireport,Java,Image,Jasper Reports,Ireport,因此,我有一个小jrxml: 这两个图像是firebird数据库中的字段类型BLOB,为了正确显示它,我在图像表达式上使用了新的ByteArrayInputStream((字节[])$F{FOFU}) 读了一点之后,我想旋转这个图像的唯一方法是在java上编程,我不知道怎么做,即使在阅读了这里和其他地方的一些帖子之后。有人能帮我吗 private byte[] rotateImage(byte[] originalImageAsBytes , double radians) throws In

因此,我有一个小jrxml:

这两个图像是firebird数据库中的字段类型BLOB,为了正确显示它,我在图像表达式上使用了新的ByteArrayInputStream((字节[])$F{FOFU})

读了一点之后,我想旋转这个图像的唯一方法是在java上编程,我不知道怎么做,即使在阅读了这里和其他地方的一些帖子之后。有人能帮我吗

private byte[] rotateImage(byte[] originalImageAsBytes , double radians) throws InternalException {
ByteArrayOutputStream rotatedImageStream = null;

try {
  BufferedImage originalImage = ImageIO.read(new ByteArrayInputStream(originalImageAsBytes)); // read the original image
  AffineTransform rotationTransform = new AffineTransform();
  rotationTransform.rotate(radians, originalImage.getWidth() / 2.0 , originalImage.getHeight() / 2.0);
  AffineTransformOp rotationTransformOp = 
    new AffineTransformOp(rotationTransform , AffineTransformOp.TYPE_NEAREST_NEIGHBOR); 
  BufferedImage rotatedImage = rotationTransformOp.filter(originalImage,null); 

  rotatedImageStream = new ByteArrayOutputStream();
  ImageIO.write(rotatedImage, "jpg" , rotatedImageStream); 
} catch (IOException e) {
  throw new InternalException(e);
}
return rotatedImageStream.toByteArray();
}
在我做的Jasper上

new ByteArrayInputStream(path.to.rotateImage((byte[])$F{IMAGE}, 100.00))

作为形象表达。工作正常。

背景变黑了