Scaled view for large images

edited January 2014 in How To...

Hi.

I'm working on some code to produce generative artwork which evolves over time. Essentially each frame adds a few hundred points/short lines. I'd like to work with fairly large images (say 5000 x 4000px), since ultimately I'd like to send them to print (on a big scale). Since the images evolve, I'd like to be able to see a scaled version onscreen (say 1/4 size) of my image so I can decide at what point to export it.

Is there a way to do that efficiently in processing? I can't seem to find anything in the docs.

Also what would be the library to use to export. I've tried using the PDF library and beginRecord/endRecord, but that results in massive files which are pretty unusable.

Am I missing something? All tips welcome.

Thanks.

Tagged:

Answers

  • Answer ✓

    Have you considered to use PGraphics for your bigger graphic?

  • Hi PhiLho

    Thanks for the tip. I've been looking at PGraphics and can see that it is the way to go for the large files. However, what I still can't work out is whether there is an efficient way of having a scaled down viewport of it so I can get an idea of what it looks like as it evolves (so I can choose when to save etc).

    I guess I can .get() it into an image every 100 or so draw cycles and scale that down to a size that fits on the screen, but is there a simpler way?

    Thanks.

  • Answer ✓

    To scale an image on the screen by 25% use

    public void draw() {
      backgound(255);
      scale(0.25);
      image(img, 0, 0);
    }
    

    where img is a PGraphics drawing surface for your artwork

  • quark and PhiLho.

    Thanks, I've got that working now. The scaling is an expensive operation though so I only do it once every 50 frames or so. If anyone else has overcome this, please let me know. I was hoping there might be a magic viewport() method or something on PGraphics objects.

    Cheers, Rob

  • I have made scalable drawings using relative rather than absolute values. However, this method probably will not suit your needs.

Sign In or Register to comment.