We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › saving to print resolution
Page Index Toggle Pages: 1
saving to print resolution (Read 963 times)
saving to print resolution
May 13th, 2005, 7:18am
 
couldn't find any references to saving out an image to print resolution, I had some ideas but I was wondering if anyone can offer up some advice on how they're doing it..

I was thinking to just run the calculations in a safe loop, and space them out over a certain amount of frames then do a save()..

are you guys displaying the frames? or doing the calculations without writing to the screen?

I know jared's probably the king of this, anyone else have any tips?

sorry if this was discussed elsewhere..
Re: saving to print resolution
Reply #1 - May 13th, 2005, 10:45am
 
Don't make a big applet, because it's double-buffered and will take up twice as much memory as you need.

If you're just modifying pixels, make a big PImage and use set() and get().  If you need drawing functions, you can use PGraphics but be aware that you need to use PGraphics2 / PGraphics3 / PGraphicsGL (I think) for P2D, P3D or OPENGL renderers, respectively.  Not sure about the JAVA2D renderer.  There is stuff about creating a PGraphics instance elsewhere on this board, and in the FAQ I think.  PGraphics can do everything that PImage can do, but also you can draw to it with the drawing functions. Update: PGraphics isn't working yet. Sorry!

The rule of thumb for how much memory you'll need is width*height*4bytes (divide by a million to get a megabyte count).

It can be tricky, since you need to draw everything twice to get a preview - once on your buffer and once on the actual applet.  You need to decide whether you're going to scale up onto the buffer, or scale down to preview.  Because you can't see what you're drawing onto the buffer until you've saved it, and saving and opening large images takes time, I recommend starting with a small buffer until you get it right Smiley

I think Jared sometimes uses Flash for his bigger prints, but I could be wrong.  Depending on the kind of graphics you're producing, you might have more luck writing out to Illustrator or Postscript, and rendering that to a big image in Photoshop, for instance.  I'm not sure what the status is of the AI and PS libraries though.
Re: saving to print resolution
Reply #2 - May 13th, 2005, 4:07pm
 
AIExport for beta is here:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_libraries_tools;action=display;num=1114686460;start=1

here's a little dated thread from the old alpha board on "from processing to paper":
http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1038136331


F


note that it used to be possible to create your own PGraphics object, this is currently not working! if it were you could just draw into that and then draw the PGraphics to the screen like an image:
Code:


// note this is currently not working!

PGraphics pg;

void setup()
{
size( 200, 200 );
pg = new PGraphics( 400, 400, null );
}

void draw()
{
pg.background( 255 );
pg.fill( 255 ); pg.stroke( 125 );
pg.line( 0,0, pg.width, pg.height );
image( pg, 0,0, width, height );
}

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1115857966;start=1
Page Index Toggle Pages: 1