使用graphicsmagick中的append()拼接图像 [英] Stitching images with append() in graphicsmagick

查看:259
本文介绍了使用graphicsmagick中的append()拼接图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大量的图像存储在单独的服务器上,需要在单个页面上显示为某种类型的马赛克,其中可以动态显示或隐藏各个元素。

I have a large number of images stored on a separate server that needs to be displayed on a single page as a mosaic of some sort where the individual elements may be shown or hidden dynamically.

这些图像应该被提取,调整大小,然后作为精灵拼接在一起,并用作div上的背景图像。此时获取和调整大小是一个非问题,因为最大的障碍是理解追加方法,或者更确切地说如何将图像添加到集合中,以便使用所述方法。

These images should be fetched, resized and then stitched together as a sprite, and used as background images on divs. Fetching and resizing is a non-issue at this point, as the biggest hurdle is understanding the append method, or rather how to add images to a set, in order to use said method.

根据文档:

gm("img.png").append(ltr)

应该:

Append a set of images

如何将多个图像变成集合?

How do I get multiple images into a "set"?

推荐答案

我能做的最好,如下......

Best I could do, was as follows ...

var gm = require('gm')

gm('@images.txt')
  .append()
  .write('crazy.png', function (err) {
    if (!err) console.log('crazytown has arrived');
  })

其中images.txt是要追加的图像列表。

Where images.txt is a list of images to append.

尚未弄清楚如何传递除图像列表文件以外的一组图像。

Have not yet been able to figure out how to pass a set of images other than an image list file.

从网站上得到了想法 - http://www.graphicsmagick.org/GraphicsMagick.html

Got the idea from the website - http://www.graphicsmagick.org/GraphicsMagick.html


运行命令行实用程序时,可以在文件名前添加一个符号@来读取该文件中的图像文件名列表。如果您有太多>图像文件名以适合命令行,这很方便。

When running a commandline utility, you can prepend an at sign @ to a filename to read a > list of image filenames from that file. This is convenient in the event you have too many > image filenames to fit on the command line.

希望能帮助
LeeT

Hope that helps LeeT

这篇关于使用graphicsmagick中的append()拼接图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆