remove red dot from top left corner of 32bit png images.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
serrotos
Posts: 11
Joined: 2014-06-25T17:58:21-07:00
Authentication code: 6789

Re: remove red dot from top left corner of 32bit png images.

Post 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"
)
)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: remove red dot from top left corner of 32bit png images.

Post by snibgo »

Yes. Some % signs need doubling.
snibgo's IM pages: im.snibgo.com
serrotos
Posts: 11
Joined: 2014-06-25T17:58:21-07:00
Authentication code: 6789

Re: remove red dot from top left corner of 32bit png images.

Post 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 %?
serrotos
Posts: 11
Joined: 2014-06-25T17:58:21-07:00
Authentication code: 6789

Re: remove red dot from top left corner of 32bit png images.

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: remove red dot from top left corner of 32bit png images.

Post 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.
snibgo's IM pages: im.snibgo.com
serrotos
Posts: 11
Joined: 2014-06-25T17:58:21-07:00
Authentication code: 6789

Re: remove red dot from top left corner of 32bit png images.

Post by serrotos »

I use it in command line. Thank you.
Post Reply