I think I have found a problem, but still dont know how to solve it.
this the sample script that illustrates my problem:
- import processing.pdf.*;
- import processing.opengl.*;
- boolean record=false;
- void setup()
- {
-
- size(600,600, OPENGL);
- background(0);
- noSmooth();
- }
- void draw()
- {
- background(0);
- noSmooth();
- println(frameCount);
- if (record)
- {
- beginRaw(PDF, "pdf_###.pdf");
- }
- createPixels();
- if (record)
- {
- endRaw();
- record=false;
- }
- }
- void createPixels()
- {
- rectMode(CENTER);
- for(int i=0; i<600; i=i+5)
- {
- for(int j=0; j<600; j=j+5)
- {
- color c = color(random(0,255),random(0,255),random(0,255));
- noStroke();
- fill(c);
- /*
- for(int m=0; m<4; m=m+1)
- {
- for(int n=0; n<4; n=n+1)
- {
- rect(i+m,j+n,1,1);
- }
- }
- */
- rect(i,j,4,4);
- }
- }
- }
- void keyPressed()
- {
- if((key == 'p') || (key == 'P'))
- {
- record = true;
- println("PDF saved!");
- }
-
- if((key == 't') || (key == 'T'))
- {
- noSmooth();
- save("tif file.tif");
- println("TIFF saved!");
- }
- }
in this example exporting as .pdf and .tiff works properly.
but if I change slightly the code (so instead of having smaller number of bigger rectangles(4x4) I end up with larger number of smaller rectangles(1x1) ), the export as .tiff does not work, but export as pdf works properly (a kind of smoothing algorithm along edges can be seen in the .tiff file). Do you, guys, have any idea what causes that problem?
below changed code that doesnt work with .tiffs:
- import processing.pdf.*;
- import processing.opengl.*;
- boolean record=false;
- void setup()
- {
-
- size(600,600, OPENGL);
- background(0);
- noSmooth();
- }
- void draw()
- {
- background(0);
- noSmooth();
- println(frameCount);
- if (record)
- {
- beginRaw(PDF, "pdf_###.pdf");
- }
- createPixels();
- if (record)
- {
- endRaw();
- record=false;
- }
- }
- void createPixels()
- {
- rectMode(CENTER);
- for(int i=0; i<600; i=i+5)
- {
- for(int j=0; j<600; j=j+5)
- {
- color c = color(random(0,255),random(0,255),random(0,255));
- noStroke();
- fill(c);
-
- for(int m=0; m<4; m=m+1)
- {
- for(int n=0; n<4; n=n+1)
- {
- rect(i+m,j+n,1,1);
- }
- }
- /*
- rect(i,j,4,4);
- */
- }
- }
- }
- void keyPressed()
- {
- if((key == 'p') || (key == 'P'))
- {
- record = true;
- println("PDF saved!");
- }
-
- if((key == 't') || (key == 'T'))
- {
- noSmooth();
- save("tif file.tif");
- println("TIFF saved!");
- }
- }