0
任何人都可以提出一種方法,我可以用它從圖像中提取像素。不是作爲文字,而是作爲圖像本身。我想從圖像中獲取所有單獨的像素作爲新圖像。每個圖像一個像素。我能找到的唯一解決方案就是打印像素的方法,也許我在搜索時沒有使用正確的關鍵字,但希望這裏有人能指出我正確的方向。從圖像中提取像素,作爲新的小圖像
有問題的圖片是jpg,並且其中有大約900張我希望變成分色像素圖片。
謝謝!
Arantxa
任何人都可以提出一種方法,我可以用它從圖像中提取像素。不是作爲文字,而是作爲圖像本身。我想從圖像中獲取所有單獨的像素作爲新圖像。每個圖像一個像素。我能找到的唯一解決方案就是打印像素的方法,也許我在搜索時沒有使用正確的關鍵字,但希望這裏有人能指出我正確的方向。從圖像中提取像素,作爲新的小圖像
有問題的圖片是jpg,並且其中有大約900張我希望變成分色像素圖片。
謝謝!
Arantxa
我無法想象,你爲什麼會想這樣做,但如果你使用的ImageMagick,這是安裝在大多數Linux發行版,可供OSX(最好通過homebrew
)和Windows,你可以做這樣的:
convert in.jpg -crop 1x1 p%d.jpg
,你會得到p0.jpg
,p1.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-03-19 11:29:38