We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all,
I've been working the the beginRecord() and endRecord() methods in Processing to export SVGs for a while now, but the SVGs I export need to be a very specific size. I've noticed that in November the size of the SVG was determined whatever was drawn between beginRecord and endRecord but since December it seems that the SVG size it always the same as the width and height of the sketch.
As a workaround I've set the size of the sketch to the exact size I need but this really limits my flexibility and keeps me from having the sketch full-screen for example. So in short:
Is there a way to export a specific area of the screen as SVG?
Thanks
Answers
I know of two ways you can do this depending on what your needs are.
(3. you can also use a few outside programs to edit the svg after the fact. I've personally used python to crop my files.)
Ah, using PGraphics sounds like a good way to go. I've been trying to add a beginRecord() and endRecord() to the CreateGraphics example but there doesn't appear to be a function beginRecord which I can call on a pgraphic object. Is this still available in Processing 3? Thanks
Eventually chose not to go down the PGraphics route and did a workaround instead. I've set the sketch resolution to have the same ratio as the area I'm exporting and upon export scale that area to the entire screen. Does not give me maximum flexibility but it works fine.