Rotating BufferedImage changes its colors

前端 未结 3 1276
谎友^
谎友^ 2020-12-06 23:39

I\'m trying to code a class to seam carve images in x and y direction. The x direction is working, and to reduce the y direction I thought about simply rotating the image 90

3条回答
  •  广开言路
    2020-12-07 00:23

    Building on what bhavya said...

    Keep it simple and you should use the dimensions expected from the operation:

    AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    BufferedImage destinationImage = op.filter(bImage, op.createCompatibleDestImage(bImage, null));
    

提交回复
热议问题