ImageMagick使用笔记
- paktc
- 出类拔萃
- 帖子: 65
- 注册时间: 2016年07月21日 20:34
- 联系:
Re: ImageMagick使用笔记
自动裁剪图片周边的空白部分 -trim 参数
但是如果主体的边缘有暗影,怎么做呢?
http://www.imagemagick.org/Usage/crop/#trim
但是如果主体的边缘有暗影,怎么做呢?
http://www.imagemagick.org/Usage/crop/#trim
Trimming with fuzzy color selection -- Low Quality JPEG Images
Because JPEG is 'lossy' the colors in the image is generally not a single color but slightly varying band of different colors. because of this "-trim" will often fail for JPEG or real world images.
FUTURE: Example of failure here
As such you need to tell ImageMagick that colors that are not-exactly the same, but are reasonally close should be treated as being the same. Adding a very small "-fuzz" setting will do this.
convert image.jpg -fuzz 1% -trim +repage image_fuzzy_trim.jpg
It is also a very good idea to specify the specific color you want that fuzz to be relative to. This can be added by specifically added a border of that color using the "-border" operator. The border will of course always match the color to be trimmed, so will always be removed by "-trim".
在线用户
正浏览此版面之用户: 没有注册用户 和 6 访客