Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Creating PDF when using copy() and multiple images

$
0
0
I think this is what you're suggesting, in terms of declaring and loading images (see below).

I compared printing one original image directly vs. running it through the sketch and printing it post-Processing. I end up with an image that's about 11x11 at 300 dpi, which is reasonable in size, although there's definitely a loss in quality in comparison with the original. A while ago I did this for a sketch that was just graphics, which looked quite good, but I see what you mean about the photo quality.

Still kinda curious, though, whether there's any way to generate a pdf in a sketch with copy(). That still seems to be the hangup. Maybe this is just a limitation in processing.pdf.

~

import processing.pdf.*;

  PImage myImage;
  PImage myImage2;
  
void setup() {
  size (800, 800);
  smooth();
  myImage = loadImage ("Picture1.jpg");
  myImage2 = loadImage ("Picture2.jpg");
  
  beginRecord (PDF, "filename.pdf");
}

void draw() {
 
    image (myImage2, 0, 0);
    int w = int(random(width));
    for (int i = 0; i < 300; i++) {
    int x = int(random(50,100));
    int y = int(random(height));
    
    copy (myImage, w, y, x, x, int(random(-200,1200)), y, x, x);
    endRecord();
    }

noLoop();
}

Viewing all articles
Browse latest Browse all 1768

Trending Articles