blank PDF
in
Core Library Questions
•
1 year ago
Hi! i'm trying to save the final scripted image as a pdf instead of a jpg; but in the script folder i get hust a blank pdf file..
I hope you can help,
Thanks
PImage img;
int increment=2;
import processing.pdf.*;
void setup(){
size (2304,1728);
beginRecord ( PDF, "file.pdf");
img = loadImage("photo31.jpg");
image(img, 2304, 1728, width, height);
loadPixels();
for (int x = 0; x < ((width*height)-(increment+2)); x+=increment) {
quicksort(pixels, x, x+increment);
}
updatePixels();
glitcher();
}
void draw() {
}
void glitchIt(int jump) {
image(img, 0, 0, 2304, 1728);
loadPixels();
for (int x = 0; x < ((width*height)-(jump+1)); x+=jump) {
quicksort(pixels, x, x+jump);
}
updatePixels();
}
void glitcher() {
float x = 150 ;
float y = 10;
int val1 = int((sqrt(x*y))*3);
glitchIt(val1);
}
int partition(int x[], int left, int right) {
int i = left;
int j = right;
int temp;
int pivot = x[(left+right)/2];
while (i <= j) {
while (x[i] < pivot) {
i++;
}
while (x[j] > pivot) {
j--;
}
if (i <= j) {
temp = x[i];
x[i] = x[j];
x[j] = temp;
i++;
j--;
}
}
return i;
}
void quicksort(int x[], int left, int right) {
int index = partition(x, left, right);
if (left < index - 1) {
quicksort(x, left, index-1);
}
if (index < right) {
quicksort(x, index, right);
}
endRecord ();
}
1