views:

48

answers:

2

Say I have an PNG image where I want to change certain pixels to, say, black. How would I do that?

My guess is that I should take the ImageMagick route. But how would I change, say, pixel ten from the top and from the left to black? To, say, 2% grey etc?


EDIT: Since the comment field doesn´t work for code, this addition is directed to eduffys answer:

Thanks. That lead me some of the way, after correcting the syntax. But it doesn´t work quite yes, as I can´t set the colour.

convert foo.png -draw ‘color 10,10 point’ foo1.png

works, painting the pixel black

convert foo.png -draw ‘#cc9999 color 10,10 point’ foo1.png

Does not return an error but doesn´t do anything visible to the file

convert foo.png -draw ‘color #cc9999 10,10 point’ foo1.png

Give me an error message.

+1  A: 

You could combine either convert or mogrify with the -draw switch and the point command. Something like this (not tested)

 mogrify foo.png -draw 'color 020202 point 10,10'
eduffy
Thanks. That lead me some of the way, after correcting the syntax. But it doesn´t work quite yes, as I can´t set the colour.<code>convert foo.png -draw ‘color 10,10 point’ foo1.png</code>works, painting the pixel black<code>convert foo.png -draw ‘#cc9999 color 10,10 point’ foo1.png</code>Does not return an error but doesn´t do anything visible to the file<code>convert foo.png -draw ‘color #cc9999 10,10 point’ foo1.png</code>Give me an error message.
Anders
A: 

If you don't mind using php script, you can take a look on: php graphic.

That way you can execute the script:


    # php add_watermark.php myimage.png

Previous link has watermark examples too. You can choose to reeplace the image, or to redirect the output to a file (remember removing HTTP headers).


    # php add_watermark.php myimage.png > myimage.wm.png

Good luck,

KikoV