Skip to content

Instantly share code, notes, and snippets.

@akof1314
Created January 20, 2015 09:47
Show Gist options
  • Save akof1314/8b350e1b6f321c8e7fba to your computer and use it in GitHub Desktop.
Save akof1314/8b350e1b6f321c8e7fba to your computer and use it in GitHub Desktop.
ImageMagick 拆分透明PNG、合并JPG和Alpha Mask
@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"
)
@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"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment