根据GraphicsMagick手册页,我可以通过使用-crop没有偏移量从图像创建多个图块:
如果省略x和y偏移,则生成覆盖整个输入图像的指定几何图形的一组图块.如果指定的几何图形超出输入图像的尺寸,则最右边的图块和底部图块会更小.
所以我运行了以下命令(在Linux下):
gm convert -crop 256x256 input.png tile # => a single file called tile
gm convert -crop 256x256 input.png tile.png # => a single file called tile.png
Run Code Online (Sandbox Code Playgroud)
如何指定输出以创建多个图像?