Intended Quality Loss
in
Programming Questions
•
2 years ago
Hi!
I want to open, save, recompress and load again an image repeatedly in order to accumulate a visible loss in quality each time mouse is pressed.
That can only works if the image is closed, re-opened, edited and saved again.
Can anybody help please???
Here is a starting point I am unsatisfied with cause there is no noticeable alteration of the original image:
- int openFile = 1; //name the source image as 1.jpg
- int saveFile = 2;
- int x, y=0;
- PImage img;
- void setup(){
- size(386, 600);//image size
- }
- void draw(){
- }
- void mousePressed(){
- //can also paste the following code into draw for automation
- img = loadImage(openFile+".jpg");
- image(img, x, y, img.width, img.height);
- img.save(saveFile+".jpg");
- openFile = saveFile;
- saveFile = saveFile+1;
- print("opening"+openFile);
- print(" saving:");
- println(saveFile+"...done!");
- if (saveFile>1000){
- exit();
- }
- }
1