Code: Select all
def decreaseRed(picture):
for pixel in getPixels(picture):
r = getRed(pixel)
setRed(pixel, r * 0.5)
Here is my extension (attached). Enter developer mode, then "load source file" from the Stage menu. Load in the PixelExtension. You'll get a new set of blocks that will let you get all the pixels in an image, and get/set individual red, green, and blue channels on those pixels. The block to "copy costume" prevents you from messing with the image in the project. (Leave it out, and you can change the images attached to the project.) With these blocks, I can write code like this:
I'm attaching an example project using these blocks.
The PixelExtension file is just plain text. I'll be happy to answer questions about it.