【问题标题】:extract pixels from an image, as new small images从图像中提取像素,作为新的小图像
【发布时间】:2015-03-19 11:17:06
【问题描述】:

谁能推荐一种我可以用来从图像中提取像素的方法。不是作为文本,在印刷品中,而是作为图像本身。我想从图像中获取所有单独的像素作为新图像。每个图像一个像素。我能找到的唯一解决方案是打印像素的解决方案,也许我在搜索时没有使用正确的关键字,但希望这里有人能指出我正确的方向。

有问题的图片是jpg,大约有900张,我都想变成单独的像素图像。

谢谢!

Arantxa

【问题讨论】:

  • 你使用的是什么操作系统?

标签: image jpeg extract pixels


【解决方案1】:

我无法想象你为什么要这样做,但如果你使用 ImageMagick,它安装在大多数 Linux 发行版上并且可用于 OSX(最好通过homebrew)和 Windows,你可以这样做:

convert in.jpg -crop 1x1 p%d.jpg

你会得到p0.jpgp1.jpg等等。

我们可以这样测试...

# Create a 4x1 black-white gradient
convert -size 4x1 gradient:black-white in.jpg

# Chop it into 1x1 pixel image lumps
convert in.jpg -crop 1x1 p%d.jpg

# Check what we got - yes, 4 images each 1x1
identify p*
p0.jpg JPEG 1x1 1x1+0+0 8-bit Gray 256c 160B 0.000u 0:00.000
p1.jpg[1] JPEG 1x1 1x1+0+0 8-bit Gray 256c 160B 0.000u 0:00.000
p2.jpg[2] JPEG 1x1 1x1+0+0 8-bit Gray 256c 160B 0.000u 0:00.000
p3.jpg[3] JPEG 1x1 1x1+0+0 8-bit Gray 256c 160B 0.000u 0:00.000

# Scale the little lumps up and append them side-by-side to see result - add border so white square is visible
convert p*.jpg -scale 100 +append -bordercolor red -border 5x5 out.png

【讨论】:

    猜你喜欢
    • 2015-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-17
    • 2021-05-19
    • 2014-06-22
    相关资源
    最近更新 更多