mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
feat(all): Modify Project Package Name cn.hutool
->org.dromara.hutool
BREAKING CHANGE: 包名变更 Closes https://gitee.com/dromara/hutool/issues/I6SC4B
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package org.dromara.hutool.swing;
|
||||
|
||||
import org.dromara.hutool.core.lang.Console;
|
||||
import org.dromara.hutool.swing.clipboard.ClipboardUtil;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ClipboardMonitorTest {
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void monitorTest() {
|
||||
// 第一个监听
|
||||
ClipboardUtil.listen((clipboard, contents) -> {
|
||||
final Object object = ClipboardUtil.getStr(contents);
|
||||
Console.log("1# {}", object);
|
||||
return contents;
|
||||
}, false);
|
||||
|
||||
// 第二个监听
|
||||
ClipboardUtil.listen((clipboard, contents) -> {
|
||||
final Object object = ClipboardUtil.getStr(contents);
|
||||
Console.log("2# {}", object);
|
||||
return contents;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package org.dromara.hutool.swing;
|
||||
|
||||
import org.dromara.hutool.swing.clipboard.ClipboardUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* 剪贴板工具类单元测试
|
||||
*
|
||||
* @author looly
|
||||
*
|
||||
*/
|
||||
public class ClipboardUtilTest {
|
||||
|
||||
@Test
|
||||
public void setAndGetStrTest() {
|
||||
try {
|
||||
ClipboardUtil.setStr("test");
|
||||
|
||||
final String test = ClipboardUtil.getStr();
|
||||
Assertions.assertEquals("test", test);
|
||||
} catch (final java.awt.HeadlessException e) {
|
||||
// 忽略 No X11 DISPLAY variable was set, but this program performed an operation which requires it.
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package org.dromara.hutool.swing;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class DesktopUtilTest {
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void browseTest() {
|
||||
DesktopUtil.browse("https://www.hutool.club");
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.hutool.swing;
|
||||
|
||||
import org.dromara.hutool.core.io.file.FileUtil;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RobotUtilTest {
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void captureScreenTest() {
|
||||
RobotUtil.captureScreen(FileUtil.file("e:/screen.jpg"));
|
||||
}
|
||||
}
|
@@ -0,0 +1,131 @@
|
||||
package org.dromara.hutool.swing.captcha;
|
||||
|
||||
import org.dromara.hutool.core.lang.Console;
|
||||
import org.dromara.hutool.swing.captcha.generator.MathGenerator;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
/**
|
||||
* 直线干扰验证码单元测试
|
||||
*
|
||||
* @author looly
|
||||
*/
|
||||
public class CaptchaTest {
|
||||
|
||||
@Test
|
||||
public void lineCaptchaTest1() {
|
||||
// 定义图形验证码的长和宽
|
||||
final LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);
|
||||
Assertions.assertNotNull(lineCaptcha.getCode());
|
||||
Assertions.assertTrue(lineCaptcha.verify(lineCaptcha.getCode()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void lineCaptchaTest3() {
|
||||
// 定义图形验证码的长和宽
|
||||
final LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 70, 4, 15);
|
||||
lineCaptcha.setBackground(Color.yellow);
|
||||
lineCaptcha.write("f:/test/captcha/tellow.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void lineCaptchaWithMathTest() {
|
||||
// 定义图形验证码的长和宽
|
||||
final LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 80);
|
||||
lineCaptcha.setGenerator(new MathGenerator());
|
||||
lineCaptcha.setTextAlpha(0.8f);
|
||||
lineCaptcha.write("f:/captcha/math.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void lineCaptchaTest2() {
|
||||
|
||||
// 定义图形验证码的长和宽
|
||||
final LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);
|
||||
// LineCaptcha lineCaptcha = new LineCaptcha(200, 100, 4, 150);
|
||||
// 图形验证码写出,可以写出到文件,也可以写出到流
|
||||
lineCaptcha.write("f:/captcha/line.png");
|
||||
Console.log(lineCaptcha.getCode());
|
||||
// 验证图形验证码的有效性,返回boolean值
|
||||
lineCaptcha.verify("1234");
|
||||
|
||||
lineCaptcha.createCode();
|
||||
lineCaptcha.write("f:/captcha/line2.png");
|
||||
Console.log(lineCaptcha.getCode());
|
||||
// 验证图形验证码的有效性,返回boolean值
|
||||
lineCaptcha.verify("1234");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void circleCaptchaTest() {
|
||||
|
||||
// 定义图形验证码的长和宽
|
||||
final CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(200, 100, 4, 20);
|
||||
// CircleCaptcha captcha = new CircleCaptcha(200, 100, 4, 20);
|
||||
// 图形验证码写出,可以写出到文件,也可以写出到流
|
||||
captcha.write("f:/captcha/circle.png");
|
||||
// 验证图形验证码的有效性,返回boolean值
|
||||
captcha.verify("1234");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void shearCaptchaTest() {
|
||||
|
||||
// 定义图形验证码的长和宽
|
||||
final ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(203, 100, 4, 4);
|
||||
// ShearCaptcha captcha = new ShearCaptcha(200, 100, 4, 4);
|
||||
// 图形验证码写出,可以写出到文件,也可以写出到流
|
||||
captcha.write("f:/captcha/shear.png");
|
||||
// 验证图形验证码的有效性,返回boolean值
|
||||
captcha.verify("1234");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void shearCaptchaTest2() {
|
||||
|
||||
// 定义图形验证码的长和宽
|
||||
final ShearCaptcha captcha = new ShearCaptcha(200, 100, 4, 4);
|
||||
// 图形验证码写出,可以写出到文件,也可以写出到流
|
||||
captcha.write("d:/test/shear.png");
|
||||
// 验证图形验证码的有效性,返回boolean值
|
||||
captcha.verify("1234");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void ShearCaptchaWithMathTest() {
|
||||
// 定义图形验证码的长和宽
|
||||
final ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 45, 4, 4);
|
||||
captcha.setGenerator(new MathGenerator());
|
||||
// ShearCaptcha captcha = new ShearCaptcha(200, 100, 4, 4);
|
||||
// 图形验证码写出,可以写出到文件,也可以写出到流
|
||||
captcha.write("f:/captcha/shear_math.png");
|
||||
// 验证图形验证码的有效性,返回boolean值
|
||||
captcha.verify("1234");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void GifCaptchaTest() {
|
||||
final GifCaptcha captcha = CaptchaUtil.createGifCaptcha(200, 100, 4);
|
||||
captcha.write("d:/test/gif_captcha.gif");
|
||||
assert captcha.verify(captcha.getCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void bgTest(){
|
||||
final LineCaptcha captcha = CaptchaUtil.createLineCaptcha(200, 100, 4, 1);
|
||||
captcha.setBackground(Color.WHITE);
|
||||
captcha.write("d:/test/test.jpg");
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package org.dromara.hutool.swing.captcha;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CaptchaUtilTest {
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void createTest() {
|
||||
for(int i = 0; i < 1; i++) {
|
||||
CaptchaUtil.createShearCaptcha(320, 240);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package org.dromara.hutool.swing.captcha;
|
||||
|
||||
import org.dromara.hutool.swing.captcha.generator.MathGenerator;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class GeneratorTest {
|
||||
|
||||
@Test
|
||||
public void mathGeneratorTest() {
|
||||
final MathGenerator mathGenerator = new MathGenerator();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
mathGenerator.verify(mathGenerator.generate(), "0");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package org.dromara.hutool.swing.img;
|
||||
|
||||
import org.dromara.hutool.swing.img.color.ColorUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public class ColorUtilTest {
|
||||
|
||||
@Test
|
||||
public void getColorTest(){
|
||||
final Color blue = ColorUtil.getColor("blue");
|
||||
Assertions.assertEquals(Color.BLUE, blue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toCssRgbTest(){
|
||||
final String s = ColorUtil.toCssRgb(Color.BLUE);
|
||||
Assertions.assertEquals("rgb(0,0,255)", s);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toCssRgbaTest(){
|
||||
final String s = ColorUtil.toCssRgba(Color.BLUE);
|
||||
Assertions.assertEquals("rgba(0,0,255,1.0)", s);
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package org.dromara.hutool.swing.img;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.Font;
|
||||
|
||||
public class FontUtilTest {
|
||||
|
||||
@Test
|
||||
public void createFontTest(){
|
||||
final Font font = FontUtil.createFont();
|
||||
Assertions.assertNotNull(font);
|
||||
}
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
package org.dromara.hutool.swing.img;
|
||||
|
||||
import org.dromara.hutool.core.io.file.FileTypeUtil;
|
||||
import org.dromara.hutool.core.io.file.FileUtil;
|
||||
import org.dromara.hutool.core.net.url.URLUtil;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.io.File;
|
||||
|
||||
public class ImgTest {
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void cutTest1() {
|
||||
Img.from(FileUtil.file("e:/pic/face.jpg")).cut(0, 0, 200).write(FileUtil.file("e:/pic/face_radis.png"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void compressTest() {
|
||||
Img.from(FileUtil.file("f:/test/4347273249269e3fb272341acc42d4e.jpg")).setQuality(0.8).write(FileUtil.file("f:/test/test_dest.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
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
|
||||
@Disabled
|
||||
public void roundTest() {
|
||||
Img.from(FileUtil.file("e:/pic/face.jpg")).round(0.5).write(FileUtil.file("e:/pic/face_round.png"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void pressTextTest() {
|
||||
Img.from(FileUtil.file("d:/test/617180969474805871.jpg"))
|
||||
.setPositionBaseCentre(false)
|
||||
.pressText("版权所有", Color.RED, //
|
||||
new Font("黑体", Font.BOLD, 100), //
|
||||
0, //
|
||||
100, //
|
||||
1f)
|
||||
.write(FileUtil.file("d:/test/test2_result.png"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void pressTextFullScreenTest() {
|
||||
Img.from(FileUtil.file("d:/test/1435859438434136064.jpg"))
|
||||
.setTargetImageType(ImgUtil.IMAGE_TYPE_PNG)
|
||||
.pressTextFull("版权所有 ", Color.LIGHT_GRAY,
|
||||
new Font("黑体", Font.PLAIN, 30),
|
||||
4,
|
||||
30,
|
||||
0.8f)
|
||||
.write(FileUtil.file("d:/test/2_result.png"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
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"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void strokeTest() {
|
||||
Img.from(FileUtil.file("d:/test/公章3.png"))
|
||||
.stroke(null, 2f)
|
||||
.write(FileUtil.file("d:/test/stroke_result.png"));
|
||||
}
|
||||
|
||||
/**
|
||||
* issue#I49FIU
|
||||
*/
|
||||
@Test
|
||||
@Disabled
|
||||
public void scaleTest() {
|
||||
final String downloadFile = "d:/test/1435859438434136064.JPG";
|
||||
final File file = FileUtil.file(downloadFile);
|
||||
final File fileScale = FileUtil.file(downloadFile + ".scale." + FileTypeUtil.getType(file));
|
||||
|
||||
final Image img = ImgUtil.getImage(URLUtil.getURL(file));
|
||||
ImgUtil.scale(img, fileScale, 0.8f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void rotateWithBackgroundTest() {
|
||||
Img.from(FileUtil.file("d:/test/aaa.jpg"))
|
||||
.setBackgroundColor(Color.RED)
|
||||
.rotate(45)
|
||||
.write(FileUtil.file("d:/test/aaa45.jpg"));
|
||||
}
|
||||
}
|
@@ -0,0 +1,186 @@
|
||||
package org.dromara.hutool.swing.img;
|
||||
|
||||
import org.dromara.hutool.core.io.IORuntimeException;
|
||||
import org.dromara.hutool.core.io.file.FileUtil;
|
||||
import org.dromara.hutool.core.lang.Console;
|
||||
import org.dromara.hutool.swing.img.color.ColorUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class ImgUtilTest {
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void scaleTest() {
|
||||
ImgUtil.scale(FileUtil.file("e:/pic/test.jpg"), FileUtil.file("e:/pic/test_result.jpg"), 0.8f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void scaleTest2() {
|
||||
ImgUtil.scale(
|
||||
FileUtil.file("d:/test/2.png"),
|
||||
FileUtil.file("d:/test/2_result.jpg"), 600, 337, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void scalePngTest() {
|
||||
ImgUtil.scale(FileUtil.file("f:/test/test.png"), FileUtil.file("f:/test/test_result.png"), 0.5f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void scaleByWidthAndHeightTest() {
|
||||
ImgUtil.scale(FileUtil.file("f:/test/aaa.jpg"), FileUtil.file("f:/test/aaa_result.jpg"), 100, 400, Color.BLUE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void cutTest() {
|
||||
ImgUtil.cut(FileUtil.file("d:/face.jpg"), FileUtil.file("d:/face_result.jpg"), new Rectangle(200, 200, 100, 100));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void rotateTest() throws IOException {
|
||||
final Image image = ImgUtil.rotate(ImageIO.read(FileUtil.file("e:/pic/366466.jpg")), 180);
|
||||
ImgUtil.write(image, FileUtil.file("e:/pic/result.png"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void flipTest() {
|
||||
ImgUtil.flip(FileUtil.file("d:/logo.png"), FileUtil.file("d:/result.png"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void pressImgTest() {
|
||||
ImgUtil.pressImage(
|
||||
FileUtil.file("d:/test/1435859438434136064.jpg"),
|
||||
FileUtil.file("d:/test/dest.jpg"),
|
||||
ImgUtil.read(FileUtil.file("d:/test/qrcodeCustom.png")), 0, 0, 0.9f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void pressTextTest() {
|
||||
ImgUtil.pressText(//
|
||||
FileUtil.file("d:/test/2.jpg"), //
|
||||
FileUtil.file("d:/test/2_result.png"), //
|
||||
"版权所有", Color.RED, //
|
||||
new Font("黑体", Font.BOLD, 100), //
|
||||
0, //
|
||||
0, //
|
||||
1f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void sliceByRowsAndColsTest() {
|
||||
ImgUtil.sliceByRowsAndCols(FileUtil.file("d:/test/logo.jpg"), FileUtil.file("d:/test/dest"), ImgUtil.IMAGE_TYPE_JPEG, 1, 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void convertTest() {
|
||||
ImgUtil.convert(FileUtil.file("e:/test2.png"), FileUtil.file("e:/test2Convert.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void writeTest() {
|
||||
final byte[] bytes = ImgUtil.toBytes(ImgUtil.read("d:/test/logo_484.png"), "png");
|
||||
FileUtil.writeBytes(bytes, "d:/test/result.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void compressTest() {
|
||||
ImgUtil.compress(FileUtil.file("d:/test/dest.png"),
|
||||
FileUtil.file("d:/test/1111_target.jpg"), 0.1f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void copyTest() {
|
||||
final BufferedImage image = ImgUtil.copyImage(ImgUtil.read("f:/pic/test.png"), BufferedImage.TYPE_INT_RGB);
|
||||
ImgUtil.write(image, FileUtil.file("f:/pic/test_dest.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toHexTest(){
|
||||
final String s = ColorUtil.toHex(Color.RED);
|
||||
Assertions.assertEquals("#FF0000", s);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void backgroundRemovalTest() {
|
||||
// 图片 背景 换成 透明的
|
||||
ImgUtil.backgroundRemoval(
|
||||
"d:/test/617180969474805871.jpg",
|
||||
"d:/test/2.jpg", 10);
|
||||
|
||||
// 图片 背景 换成 红色的
|
||||
ImgUtil.backgroundRemoval(new File(
|
||||
"d:/test/617180969474805871.jpg"),
|
||||
new File("d:/test/3.jpg"),
|
||||
new Color(200, 0, 0), 10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMainColor() throws MalformedURLException {
|
||||
final BufferedImage read = ImgUtil.read(new URL("https://pic2.zhimg.com/v2-94f5552f2b142ff575306850c5bab65d_b.png"));
|
||||
final String mainColor = ColorUtil.getMainColor(read, new int[]{64,84,116});
|
||||
System.out.println(mainColor);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void createImageTest() throws IORuntimeException, IOException {
|
||||
ImgUtil.createImage(
|
||||
"版权所有",
|
||||
new Font("黑体", Font.BOLD, 50),
|
||||
Color.WHITE,
|
||||
Color.BLACK,
|
||||
ImageIO.createImageOutputStream(new File("d:/test/createImageTest.png"))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void createTransparentImageTest() throws IORuntimeException, IOException {
|
||||
ImgUtil.createTransparentImage(
|
||||
"版权所有",
|
||||
new Font("黑体", Font.BOLD, 50),
|
||||
Color.BLACK,
|
||||
ImageIO.createImageOutputStream(new File("d:/test/createTransparentImageTest.png"))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void issue2765Test() {
|
||||
// 利用图片元数据工具读取图片旋转角度信息
|
||||
final File file = FileUtil.file("d:/test/204691690-715c29d9-793a-4b29-ab1d-191a741438bb.jpg");
|
||||
final int orientation = ImgMetaUtil.getOrientation(file);
|
||||
Console.log(orientation);
|
||||
Img.from(file)
|
||||
.rotate(orientation)
|
||||
.write(FileUtil.file("d:/test/aaa.jpg"));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user