Slicing Images
in
Programming Questions
•
11 months ago
Hello,
I have a series of images "loo0001.bmp" thru "loo1450.bmp" each 1080x720 pixel.
I have written a program (trying) to take each .bmp and export 1 pixel columns along the entire image. Giving me 1080 1x720 pixel images (per .bmp image)
Here is my code:
- for(int f=0; f<1; f++) {
- String imageName = "loo" + nf(f+1,4) + ".bmp";
- PImage img = loadImage(imageName);
- for(int p=0; p<1280; p++){
- copy(img, p, 0, 1, 720, 0, 0, 1, 720);
- String outName = "slice" + nf(f+1, 5) + "-" + nf(p, 5);
- save(outName);
- }
- }
I believe my issue is somewhere in the copy() function, but I am not sure exactly where I have my error. When exporting every frame is a 100x100 pixel (almost) blank image with the farthest left column being black.
I believe this column is part of the original .bmp, playing around with the numbers in copy() I am able to export a 100x100 pixel non-blank image of what appears to be the top left of my original .bmp I am importing.
I appreciate any help, please let me know if I am unclear or if any other information would be useful.
1