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 & HelpPrograms › Image, how to export a part of it
Page Index Toggle Pages: 1
Image, how to export a part of it (Read 975 times)
Image, how to export a part of it
May 28th, 2008, 11:19pm
 
Hello,

A little practical question.
I've learnt to export an image but I'ld like to know if it would be possible to export just a part of it and not the whole program-screen.

for example if the size is 800 by 600, is it possible to export just 300 by 300 ?

thanks for your attention.
Re: Image, how to export a part of it
Reply #1 - May 29th, 2008, 12:19am
 

PImage newImg = new PImage(origImg.get(x,y,x+300,y+300));

newImg.save("C:/foo.png");
Re: Image, how to export a part of it
Reply #2 - May 29th, 2008, 1:36pm
 
Hello Manic,

I've tried to apply your advices but it doesn't work really.
I can export a file with the dimensions I want, BUT, there is not any image, just a black background.
I don't understand why.

I still try...

thanks !
Re: Image, how to export a part of it
Reply #3 - May 29th, 2008, 1:52pm
 
are you saving from the screen or from an image?
Re: Image, how to export a part of it
Reply #4 - May 29th, 2008, 1:55pm
 
this should do it:
Code:
PImage outgoing = get(x, y, 300, 300);
outgoing.save("something.jpg");

http://processing.org/reference/get_.html
http://processing.org/reference/save_.html
Re: Image, how to export a part of it
Reply #5 - May 30th, 2008, 3:06pm
 
Hello,

According to he both different way to realize the exportation, I've recapitulated the program I'm doing and I've succeeded to do it...
to answer the question of Manic, I was saving from the screen while the program run.

Thank you so much for your help...
Page Index Toggle Pages: 1