It's easy to grab a horizontal or vertical line of pixels from a PImage object by using the get() function. But I need to be able to grab a line of pixels from a PImage when the line can be at any arbitrary angle...vertical, horizontal, diagonal, or anywhere in between.
I'd like to avoid doing a bunch of math and then pulling individual pixels out of the pixel array and assembling them into the line. Is there an easy way?
I have some simple code that grabs an image, finds every pixel that's more blue than red or green, and turns those pixels transparent. That all seems to work. But I also want to save a new PNG that includes those transparent pixels. That part doesn't seem to work -- the output PNG is just solid black. What am I doing wrong here?
Thanks in advance!
void setup() {
int imageWidth = 2048;
int imageHeight = 1216;
color clear = color(0x00000000);
I feel like I'm missing something very simple here. I'm creating a simple image of random colored pixels and want the red value of each pixel to increase step by step. For the life of me I can't figure out why I'm not seeing the image change tint. What am I missing? Here's the code...
I have a large collection of PNGs that are cross-sections of a microscopic sample. I want to be able to generate composite images that simulate what a cross-section would have looked like if the slices had been taken through another angle. I figure I should be able to do this by a bit of clever bit of 3-D math, grabbing the rgb value of appropriate pixel of the various pre-existing images, and then using them to draw out a new image.
I worry though that having to load all of the images one at a time via loadImage() just so I can grab the pixel info will be quite slow. I'm wondering if it's possible to just kind of reach into the binary file for each png and read a specific pixel value that way. But I have no idea if that's feasible with the png format (not really knowing anything about how .png files actually store images).
Does anyone have any insight in this? By any miracle is there some sort of function that does this?
I need to make a sketch that's 1600 x 1600 pixels. Since that's bigger than my screen resolution, I was wondering if there's some way to make the sketch have scroll bars, so I could see the whole thing on my screen? Thanks!