Random Pixel recoloring
Random Pixel recoloring
Is there already a script or something that will recolor a random pixel of a batch of images?
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Random Pixel recoloring
There are probably several simple ways to do what you're asking, but we need a lot more information to point you in the right direction. Look over the suggestions at "Read This First", then let us know what platform you're working on, which version of ImageMagick you're using, and provide a little better explanation of exactly what result you're trying to achieve.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Random Pixel recoloring
Is it the same random pixel in all images or different random pixels in each image? Is it only one pixel that needs recoloring randomly? A better explanation or example images would help us understand your problem. Also always provide your IM version and platform since syntax and scripting may differ
You can compute a random number in Imagemagick using the "%[fx:random()]" with values between 0 and 1. You can scale the values by multiplying X*random() in the expression. You can compute that number once for w*random() and again for h*random. To get some random coordinate and then -draw a pixel of some color to that coordinate.
If you want to do this for all images at the same coordinate, then use mogrify to process all images in a directory at the same location. If you need each image to have a separate random coordinate changed, then you will need to write a script loop over each image.
See
http://www.imagemagick.org/script/fx.php
http://www.imagemagick.org/Usage/transform/#fx
http://www.imagemagick.org/Usage/draw/#primitives
http://www.imagemagick.org/Usage/basics/#mogrify
You can compute a random number in Imagemagick using the "%[fx:random()]" with values between 0 and 1. You can scale the values by multiplying X*random() in the expression. You can compute that number once for w*random() and again for h*random. To get some random coordinate and then -draw a pixel of some color to that coordinate.
If you want to do this for all images at the same coordinate, then use mogrify to process all images in a directory at the same location. If you need each image to have a separate random coordinate changed, then you will need to write a script loop over each image.
See
http://www.imagemagick.org/script/fx.php
http://www.imagemagick.org/Usage/transform/#fx
http://www.imagemagick.org/Usage/draw/#primitives
http://www.imagemagick.org/Usage/basics/#mogrify