我正在尝试显示图像的尺寸,然后使用我的系统说在那里调用的程序调整它们的大小Package ImageMagick-6.5.4.7-7.el6_5.i686 already installed and latest version。
但得到错误:
-bash-4.1# 显示 main-bg1.jpg
显示:无法打开 X 服务器`'@display.c/DisplayImageCommand/420。
我在一个目录中有几个图像文件。这些图像大小相似,背景颜色相同。
如何通过添加像此附加图像这样的背景来使所有图像大小相同?

我正在将一堆 pdf 矢量图形转换为 png 文件。
for f in *.pdf
do convert -trim ${f} "${f}.png"
done
rename 's/\.pdf//' *.png
Run Code Online (Sandbox Code Playgroud)
但是图片的尺寸太小了。
的文档convert告诉了一个-size width height选项,但我不能为所有图片指定一个唯一的大小。还有其他方法吗?
在我的系统上,我安装了ImageMagick及其文档:
$ apt-cache pkgnames imagemagick
imagemagick
imagemagick-6.q16
imagemagick-dbg
imagemagick-doc
imagemagick-common
Run Code Online (Sandbox Code Playgroud)
我可以访问convert的手册页,ImageMagick(1)如果我想了解更多信息,请参阅该手册页。
man ImageMagick说No manual entry for ImageMagick。
最后,man -k imagemagick说:
quantize (5) - ImageMagick's color reduction algorithm.
Run Code Online (Sandbox Code Playgroud)
如何在我的系统上访问ImageMagic的手册页?
上面我错了。
apt-cache pkgnames列出的软件包“不一定可供下载、安装或安装”(参考APT-CACHE(8))。所以,我的命令没有列出已安装的软件包。
挖掘更多,我结束了
$ apt list imagemagick*
Listing... Done
imagemagick/xenial-updates,xenial-security,now 8:6.8.9.9-7ubuntu5.4 amd64 [installed]
imagemagick-6.q16/xenial-updates,xenial-security,now 8:6.8.9.9-7ubuntu5.4 amd64 [installed,automatic]
imagemagick-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 8:6.8.9.9-7ubuntu5.4 all [installed,automatic]
imagemagick-dbg/xenial-updates,xenial-security 8:6.8.9.9-7ubuntu5.4 amd64
imagemagick-doc/xenial-updates,xenial-updates,xenial-security,xenial-security 8:6.8.9.9-7ubuntu5.4 all …Run Code Online (Sandbox Code Playgroud) 我想使用 .pdf 将 PDF 转换为 PNG 图像convert。图像必须符合 1920x1080 比率,具有 ?x1080 比率,并具有最佳质量。
这里有很多我可以使用转换的选项:https : //imagemagick.org/script/command-line-options.php#append
convert my.pdf -geometry 1920x1080 -size 1920x1080 -density 1920x1080 my_resized_pdf.png
命令的结果为我提供了具有良好几何形状 (763x1080) 的图像,但我不想获得低质量的图像。
convert my.pdf -size 1920x1080 -density 1920x1080 my_resized_pdf.png
结果的质量正是我想要的,但分辨率不是 1920x1080 比例,而是 842x595。它并不完全适合 1920x1080 的高度。
是否可以从 PDF 中获得 ?x1080 比例和 100% 质量的 PNG 图像?或者 842x595 是获得 100% 质量图像的最大比例?我应该将 DPI 选项设置为convert吗?
我需要将 pdf 文件转换为图像文件(如:png(首选)、jpeg)。
我使用过convert(来自 ImageMagick 包),但只有表格(类似于发票)的 2 页 pdf 文件需要 4 秒以上,所以这个 pdf 真的很轻。我发现,convert使用gs做到这一点。如果我用 来做这件事gs,结果质量会更好,渲染速度也会更快。
所以我有3个问题:
gs可以帮助我更快、更好地获取 png 或 jpg 文件?我想合并两张图片,但我不知道如何通过任何 Linux/Unix 工具在 y 轴上找到剪切位置,但这里的第一个想法是ImageMagick。欢迎任何方法:程序化解决方案或手动协助解决问题的方法。两张图片在y轴上有联合相似性,我想最小化然后合并输出。伪代码
convert -gravity SouthWest -crop 100x70%x+0+0 infile.jpg outfile.jpg。对于底部类似,convert -gravity NorthWest -crop 100x70%x+0+0 infile.jpg outfile.jpg。convert -append A-edit.jpg B-edit.jpg output.png 图 1 图像 A,图 2 图像 B,图 3 预期输出
我有三张照片,a.png, b.png 和 c.png,我需要将它们组合成两行(上下),以便a.png位于b.png和c.png的顶部中心,即它好像
a.png
b.png c.png
Run Code Online (Sandbox Code Playgroud)
我用过这个命令
convert \( a.png \) \( b.png c.png +append \) -append combine.png
Run Code Online (Sandbox Code Playgroud)
但是这个命令不会将a.png放在第一个原始图像的中间,而是组合后的照片看起来像
a.png
b.png c.png
Run Code Online (Sandbox Code Playgroud) imagemagick ×10
conversion ×3
images ×3
pdf ×3
scripting ×2
ghostscript ×1
linux ×1
man ×1
png ×1
split ×1