使用 RMagick 将 20 个 256x256 缩略图组合成 4 行 x 5 列的单个大图像的最短方法是什么?
假设所有图像都在当前目录中,并且命名为 1.jpg 到 n.jpg 且 row * col = n。
include Magick
row = NUM_ROWS
col = NUM_COLS
ilg = ImageList.new
1.upto(col) {|x| il = ImageList.new
1.upto(row) {|y| il.push(Image.read((y + (x-1)*col).to_s + ".jpg").first)}
ilg.push(il.append(false))}
ilg.append(true).write("out.jpg")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)