3.9K Star 22.5K Fork 7.8K

GVPdromara / hutool

 / 详情

Img.from().cut().write() 功能错误

已完成
创建于  
2020-11-19 17:18

版本情况

JDK版本: 14
hutool版本: 5.4.1

问题描述(包括截图)

Rectangle 设置:
int left = 118; int top = 174; int width = 250; int height = 326; Rectangle rectangle = new Rectangle(left,top,width,height);

原图:
输入图片说明

使用 Img.from(f).cut(rectangle).write(out); 效果如下,是错误的
输入图片说明

使用 ImgUtil.cut(new FileInputStream(f),out,rectangle); 则会出现正确结果
输入图片说明

评论 (1)

啊昕 创建了任务
啊昕 关联仓库设置为Hutool/hutool
展开全部操作日志

默认坐标是从中间计算的,你应该:

Img.from(srcImage).setPositionBaseCentre(false).cut(rectangle).getImg();
Looly 任务状态待办的 修改为已完成
Looly 添加了
 
question
标签

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
1463 loolly admin 1578914022
Java
1
https://gitee.com/dromara/hutool.git
git@gitee.com:dromara/hutool.git
dromara
hutool
hutool

搜索帮助