JPEG encoding
in
Programming Questions
•
11 months ago
Hi fellas and ladies,
However, as I understand, this will not work if I want to use this program as a web application because it won't have permissions to save an image to the computer, which I do in line 17. Could anyone give me advice on how to get around this - either by modifying my code to use something other than saveBytes to change my JPG, or by finding a permissions workaround?
I'm trying to write a program that will take a JPG image, change some bytes of the image code, and re-output the new image. I was able to accomplish this in one way:
- byte b[];
- int start = 4000;
- int step = 200;
- void setup() {
- size(1000, 612);
- b = loadBytes("sourceImage.jpg");
- }
- void draw() {
- for(int i = start; i<start+step; i++) {
- b[i] = 0;
- }
- start+=step;
- saveBytes("output.jpg", b);
- PImage img = loadImage("output.jpg");
- image(img,0,0);
- }
Thanks!
Keenan
1