Is there a way to affect all the non-zero cells in the transparency column (Column D) of an image without changing the cells with zero in them?
I would like to add amounts to the non-zero cells (thereby changing their transparency / opaqueness) without affecting the cells that have a zero in them (i.e., the cells in the background portion of the image in this instance).
This was very helpful. I wanted to affect the transparency of the image (a bouquet of flowers in the illustration below) without affecting the background pixels. Thanks!
There's really no need to construct a new list in newPixels. (Insert rant about camel case here.) PIXELS OF COSTUME already gives you a new list (contrary to what I thought until I tried it), so instead of putting an ADD block in the loop, you can just do
@cymplecy That works for subtraction and is much faster. It doesn't work for addition, because the background pixels are changed from 0 (completely transparent) to opaque (a value of 50 in this instance), resulting in a gray square surrounding the image. That would present a problem for creation of a bi-directional transparency / opacity slider (for example). However, one work-around might be to simply reset the image to its original state, and then always subtract. This seems to work because zero is at the lower end of the transparency range. Subtracting 100 from 0 in the alpha column seems to result in 0 (and not "- 100").
I like the hyperblock solution better because it is faster and simpler. Thanks for the assist!
@cymplecy The hyperblock method is so fast that even resetting the image each time doesn't perceptibly slow the movement of the transparency slider. Thanks!