如何在imagemagick中裁剪边距?
我有很多原本没有边距的图像(*.pdf)。这些文件有各种大小,但通常从 8000x4000 到 20000x14000 像素。
我使用此命令将它们转换为 jpeg:
for /r %x in (*.pdf) do Convert -diesel 400 -quality 100% "%x" "%x.jpg"
但它会产生很大的利润。边距占图像大小的 30%。所以我需要阻止它们或裁剪它们。我尝试查看 IM 手册以查找如何获取宽度和高度并减去一些值并将其添加到 -crop 中。但这对我来说太难了,我试图解决它大约1.5小时但没有结果。我是即时通讯新手。有人可以告诉我如何解决这个问题并删除边距吗?
另外我想将文件名从例如map.pdf修复为map.jpg现在它的结果是map.pdf.jpg
I have many images (*.pdf) that originally do not have margin. The files are in various sizes but usually from 8000x4000 to 20000x14000 px.
I use this command to convert them to jpeg:
for /r %x in (*.pdf) do convert -density 400 -quality 100% "%x" "%x.jpg"
But it produces big margins. Margins take 30% of the image size. So I need to prevent them or to crop them. I tried to look in IM manual to find how to obtain width and height and to substract some value and to add it to -crop. But this his too hard to me, I am tring to solve it about 1,5 hours without result. And I am new to IM. Can somebody tell me how to solve this and remove the margin?
Also I would like to repair name of file from e.g. map.pdf to map.jpg Now it result in map.pdf.jpg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用此代码在转换为光栅后裁剪图像:
I used this code to crop the image after conversion to raster: