mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add default method
This commit is contained in:
@@ -554,7 +554,7 @@ public class Img implements Serializable {
|
||||
* @return 处理过的图片
|
||||
*/
|
||||
public Image getImg() {
|
||||
return this.targetImage;
|
||||
return null == this.targetImage ? this.srcImage : this.targetImage;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,6 +20,13 @@ public class ImgTest {
|
||||
public void compressTest() {
|
||||
Img.from(FileUtil.file("f:/test/4347273249269e3fb272341acc42d4e.jpg")).setQuality(0.8).write(FileUtil.file("f:/test/test_dest.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void writeTest() {
|
||||
final Img from = Img.from(FileUtil.file("d:/test/81898311-001d6100-95eb-11ea-83c2-a14d7b1010bd.png"));
|
||||
ImgUtil.write(from.getImg(), FileUtil.file("d:/test/dest.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
|
@@ -102,7 +102,8 @@ public class ImgUtilTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void compressTest() {
|
||||
ImgUtil.compress(FileUtil.file("e:/pic/1111.png"), FileUtil.file("e:/pic/1111_target.jpg"), 0.8f);
|
||||
ImgUtil.compress(FileUtil.file("d:/test/dest.png"),
|
||||
FileUtil.file("d:/test/1111_target.jpg"), 0.1f);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user