This commit is contained in:
Looly
2020-06-03 18:15:33 +08:00
parent 93951af07e
commit 8e2f63d576
5 changed files with 20 additions and 8 deletions

View File

@@ -633,7 +633,8 @@ public class Img implements Serializable {
} else {
point = new Point(rectangle.x, rectangle.y);
}
GraphicsUtil.drawImg(g, img, point);
rectangle.setLocation(point.x, point.y);
GraphicsUtil.drawImg(g, img, rectangle);
g.dispose();
return backgroundImg;

View File

@@ -6,6 +6,7 @@ import org.junit.Test;
import java.awt.Color;
import java.awt.Font;
import java.awt.Rectangle;
public class ImgTest {
@@ -46,4 +47,12 @@ public class ImgTest {
1f)
.write(FileUtil.file("d:/test/test2_result.png"));
}
@Test
@Ignore
public void pressImgTest(){
Img.from(FileUtil.file("d:/test/图片1.JPG"))
.pressImage(ImgUtil.read("d:/test/617180969474805871.jpg"), new Rectangle(0, 0, 800, 800), 1f)
.write(FileUtil.file("d:/test/pressImg_result.jpg"));
}
}