Skip to content

Instantly share code, notes, and snippets.

@cletusw
Last active March 23, 2023 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cletusw/648076667040699f9ec148b322e76a4e to your computer and use it in GitHub Desktop.
Save cletusw/648076667040699f9ec148b322e76a4e to your computer and use it in GitHub Desktop.
Windows batch script that prepares (pre-multiplies) an image file for use as an overlay on an ATEM video switcher (see https://www.youtube.com/watch?v=N2vLs9i0bA0 and https://stackoverflow.com/questions/6591361/method-for-converting-pngs-to-premultiplied-alpha#comment74190171_27177752 ). Requires ImageMagick: https://imagemagick.org/script/downl…
@echo off
rem Source: https://gist.github.com/cletusw/648076667040699f9ec148b322e76a4e
if "%~1"=="" goto :usage
if not "%~2"=="" goto :usage
set "OUTPATH=%~dp1processed\"
if not exist "%OUTPATH%" (
mkdir "%OUTPATH%"
)
set "OUT=%OUTPATH%%~n1_processed%~x1"
magick "%~1" -background black -alpha Remove "%~1" -compose Copy_Opacity -composite "%OUT%" && (
echo Wrote %OUT%
)
goto :eof
:usage
echo Prepares (pre-multiplies) an image file for use as an overlay on an ATEM video switcher
echo Usage:
echo. %0 image_file_with_transparency.png
echo.
:eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment