如何在ImageMagick中提高蒙太奇的图像输出?

时间:2016-01-17 01:46:25

标签: imagemagick image-manipulation montage

我使用montage加入了图像,但图像输出的分辨率低于图像输入的分辨率。

我的图片输入尺寸为640x480

但我得到的输出是256x378

我在网上搜索,找不到提高输出图像质量的解决方案。

我正在使用的蒙太奇命令

montage -tile 2x3 1.png 2.png 3.png 4.png 5.png 6.png -resize 1024x1024  montage_png.png

任何人都知道如何才能获得更好的输出分辨率?

3 个答案:

答案 0 :(得分:8)

将操作方式( function postError(message, errorCode, source) { var getLogFn = common.logger.getLogFn; var deferred = $q.defer(); var error = {}; error.Error = message; error.ErrorCode = errorCode; error.StackTrace = source; $http.post("/api/error/", error).success(function (data) { deferred.resolve(data); }).error(function (msg, code) { deferred.reject(msg); $log.error(msg, code); }); return deferred.promise; } )设置为-mode值(as in the documentation)。

例如:

concatenate

答案 1 :(得分:5)

建议1

以这种方式试试......让montage将图片整理成蒙太奇,然后将结果传递给convert,以便对结果进行大小调整。

montage -tile 2x3 1.png 2.png 3.png 4.png 5.png 6.png miff:- | convert miff:- -resize 1024x1024 montage.png

中间图像作为MIFF(Magick图像文件格式)传递,保留所有细节,元数据和质量。

建议2

如果它总是只有5或6张图片而不是数百张,那么您也可以使用convert这样一次完成所有操作。您需要知道的是+append连接图像并-append将图像连接到一列中。所以我连续加入1& 2,连续3& 4加入5& 4连续6行然后将三行放入堆栈并调整结果大小。

convert [12].png +append \( [34].png +append \) \( [56].png +append \) -append -resize 1024x1024 result.png

enter image description here

答案 2 :(得分:1)

蒙太奇很容易使用:

montage -mode concatenate -tile 2x3 *.png -resize 1024x1024 outfile.png

但是如果你第二次运行它,这个命令也会包含outfile.png作为新蒙太奇的一部分,当然。

蒙太奇足够聪明,可以正确更改格式,因此命令可以更改为:

montage -mode concatenate -tile 2x3 *.png -resize 1024x1024 outfile.jpg

这导致文件宽度为2048像素。

如果输入文件大小均匀,最简单的方法是使用它:

montage -mode concatenate -tile 2x3 *.jpg outfile.jpg

至于问题:

在具有gnuplot终端的png中,默认画布大小为640x480,因此正确JPG的2x3蒙太奇会产生1280像素宽的文件。

显示在太宽而无法打印的网页上。打印边界大约为640像素宽(取决于边距的设置方式),因此它通常可以很好地用于:

montage -mode concatenate -tile 2x3 -resize 320x240 *.png outfile.jpg

使用320x240可保留原始图的纵横比。

如果这是期望的结果,则应该在set terminal内的gnuplot命令中强制它变为正方形。

图像后处理的最佳做法是避免使图像扭曲超出生成原件的程序的意图。