我需要使用image.setCorners()来倾斜图像,这可以使用JavaXT库来完成。但是,我有BufferedImage格式的图像,而不是保存的文件。
那么,如何将BufferedImage转换为javaxt.io.Image,以便对其执行斜操作。
下面是我用来倾斜图像的代码:
javaxt.io.Image image = new javaxt.io.Image("image1.jpg");
System.out.println(image.getWidth() + "x" + image.getHeight());
int width = image.getWidth();
int height = image.getHeight();
image.setCorners(0, 0, //UL
width, 10, //UR
width, height-10, //LR
0, height); //LL发布于 2015-06-02 15:38:15
javaxt.io.Image类有一个构造函数,类似于:
public Image(java.awt.image.BufferedImage bufferedImage)所以你可以:
javaxt.io.Image image = new javaxt.io.Image(bufferedImage);https://stackoverflow.com/questions/30598043
复制相似问题