标签:imagemagick 图片
透明PNG图片占用空间较大,可以拆分为JPG图片和只带Alpha的PNG图片。这里使用ImageMagick进行拆分和合并实验。
2 |
"D:\Program Files\ImageMagick-6.9.0-Q16\convert.exe" Bird.png -background black -alpha remove Bird.jpg
"D:\Program Files\ImageMagick-6.9.0-Q16\convert.exe" Bird.png -alpha extract Bird_alpha_mask.png |
|
"D:\Program Files\ImageMagick-6.9.0-Q16\convert.exe" Bird.jpg Bird_alpha_mask.png -compose copyopacity -composite Bird_with_alpha.png
|
2 3 4 5 6 7 |
@echo off
set exevar="D:\Program Files\ImageMagick-6.9.0-Q16\convert.exe" for /f "usebackq tokens=*" %%d in (`dir /s /b *.png`) do ( %exevar% "%%d" -background black -alpha remove "%%~dpnd.jpg" %exevar% "%%d" -alpha extract "%%~dpnd_alpha_mask.png" ) |
2 3 4 5 6 |
@echo off
set exevar="D:\Program Files\ImageMagick-6.9.0-Q16\convert.exe" for /f "usebackq tokens=*" %%d in (`dir /s /b *.jpg`) do ( %exevar% "%%d" "%%~dpnd_alpha_mask.png" -compose copyopacity -composite "%%~dpnd_with_alpha.png" ) |
ImageMagick 拆分透明PNG、合并JPG和Alpha Mask
标签:imagemagick 图片
原文地址:http://blog.csdn.net/akof1314/article/details/42922051