I'm trying to create a white background removal script and came across this:
Set transparent background using ImageMagick and commandline prompt
The solution from the above link that I want to implement is this:
color=$( convert filename.png -format "%[pixel:p{0,0}]" info:- )
convert filename.png -alpha off -bordercolor $color -border 1 \
\( +clone -fuzz 30% -fill none -floodfill +0+0 $color \
-alpha extract -geometry 200% -blur 0x0.5 \
-morphology erode square:1 -geometry 50% \) \
-compose CopyOpacity -composite -shave 1 outputfilename.png
The syntax is UNIX flavored. I want to utilize this call in Powershell. I'm hung up on this line:
color=$( convert filename.png -format "%[pixel:p{0,0}]" info:- )
$
is a variable prefix in PowerShell. Furthermore I don't even understand what that line is doing - it looks like it's storing a variable to be used in the next convert call.
Also, I don't know how to handle all the backslashes. Should I use a back-tick instead?
Can someone possibly refactor the above command to be compatible with PowerShell?
I appreciate any help at all.