help duplicating images
in
Programming Questions
•
6 months ago
is there a faster way to duplicate an image, a deep copy, so different filters can be applied without changing the original image. This is what I have but it seems over the top right now, whenever I use a for loop I feel like there is probably a better way of going about it.
- PImage img1, img2;
- void setup() {
- img1 = loadImage("something.jpg");
- img2 = createImage (img1.width, img1.height, RGB);
- img2.loadPixels();
- for (int i = 0; i< img1.pixels.length; i++)
- {img2.pixels[i] = img1.pixels[i];}
- img2.updatePixels();
- size(img1.width,img1.height);
- img2.filter(INVERT);
- }
1