Page 2 of 2
Re: remove red dot from top left corner of 32bit png images.
Posted: 2014-06-27T21:05:03-07:00
by serrotos
This does not work, but you mean something like this?
Code: Select all
FOR /R %A in (*.png) DO (
FOR /F "usebackq skip=1 tokens=6 delims=():, " %C ^
IN (`convert %A ^
-alpha off ^
-crop 1x1+0+0 ^
-depth 16 ^
txt:`) ^
DO set ONE_PIXEL=%C
if "%ONE_PIXEL%"=="#FFFF00000000" (
convert "%A" -fill "rgba(255,255,255,0)" -draw "color 0,0 point" png32:"%~npA.png"
)
)
Re: remove red dot from top left corner of 32bit png images.
Posted: 2014-06-27T21:15:35-07:00
by snibgo
Yes. Some % signs need doubling.
Re: remove red dot from top left corner of 32bit png images.
Posted: 2014-06-28T01:01:11-07:00
by serrotos
This looks fine. It gets file path in %A.
Code: Select all
FOR /R %A in (*.png) DO (
FOR /F "usebackq skip=1 tokens=6 delims=():, " %C ^
IN (`convert "%A" ^
-alpha off ^
-crop 1x1+0+0 ^
-depth 16 ^
txt:`) ^
DO set ONE_PIXEL=%C
if "%ONE_PIXEL%"=="#FFFF00000000" (
convert "%A" -fill "rgba(255,255,255,0)" -draw "color 0,0 point" png32:"%~npA.png"
)
)
but, in For/F %A gets glitched.
I get this error.
convert.exe: unable to open image `ツ.
convert.exe: no decode delegate for this image format `' @ error/constitute.c/Re
adImage/501.
Does it need double %?
Re: remove red dot from top left corner of 32bit png images.
Posted: 2014-06-28T04:47:28-07:00
by serrotos
Code: Select all
FOR /R %A in (*.png) DO (
FOR /F "usebackq skip=1 tokens=6 delims=():, " %C IN (`convert "%A" -alpha off -crop 1x1+0+0 -depth 16 txt:`) DO set ONE_PIXEL=%C
if "%ONE_PIXEL%"=="#FFFF00000000" ( convert "%A" -fill "rgba(255,255,255,0)" -draw "color 0,0 point" png32:"%~npA.png")
)
This works fine with no error, but I need to execute it at least two times to work it properly. I don't know why. And if there are files that has non-English file name, this script won't work.
Re: remove red dot from top left corner of 32bit png images.
Posted: 2014-06-28T05:49:00-07:00
by snibgo
If you are running this from a BAT file, each %A, %C, %~npA needs % to be doubled.
I don't know about non-English filenames. Sorry.
Re: remove red dot from top left corner of 32bit png images.
Posted: 2014-06-28T22:12:26-07:00
by serrotos
I use it in command line. Thank you.