[英]How can I interlace two images using ImageMagick?
我也有同樣的尺寸,稱為2個圖像image1.png
和image2.png
。 在ImageMagick中,是否有任何方法可以image1.png
合並image2.png
的奇數行並與image2.png
的偶數行合並來合並兩個圖像?
當然,使備用行透明:
# Make red test image
convert -size 300x200 xc:red red.png
# Make blue test image
convert -size 300x200 xc:blue blue.png
# Merge with alternate lines made transparent
convert red.png \( blue.png -alpha on -channel A -fx 'j%2' \) -composite result.png
或者,另一種思考方式是加載兩個圖像,然后根據行從第一個( u
)或第二個( v
)中選擇像素:
convert red.png blue.png -fx 'j%2 ? u : v' result.png
在Windows上,這兩個結果為:
REM Do Windows style commands
convert red.png ^( blue.png -alpha on -channel A -fx "j%2" ^) -composite result.png
和
REM Windows style
convert red.png blue.png -fx "j%2 ? u:v" result.png
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.