FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   Help with Image
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Help with Image  (Read 1107 times)
Betaruce
Guest
Email
Help with Image
« on: Jul 27th, 2003, 2:53pm »

BImage b;
 
void setup(){
  size(200,300);
  background(255);
  b = loadImage("bg.jpg");
  image(b,0,0);
}
 
I've put my bg.jpg into the data folder
but then nth happens
 
pls help thx.
 
arielm

WWW
Re: Help with Image
« Reply #1 on: Jul 27th, 2003, 5:40pm »

it's because setup() is not the right place for your image() statement:
 
put it inside a loop() or a draw() and it'll work...
 

Ariel Malka | www.chronotext.org
Betaruce
Guest
Email
Re: Help with Image
« Reply #2 on: Jul 27th, 2003, 6:20pm »

thx
 
can you further explaine about that?
 
I always meet similar problem
 
inside loop() its fine but in setup() no........
 
Betaruce
Guest
Email
Re: Help with Image
« Reply #3 on: Jul 27th, 2003, 6:24pm »

also what is that draw()?
 
I cant seem to find it.........
 
 
another questions
 
1> the Network code seems doesnt work in my version...it's for newer version right?
 
2> setPixel.....and other drawing codes......
if I put it in the loop(), it seems it must redraw in the next loop........
what if I only want things to be drawn once so that the comptuer need not repeat drawing all the time?
 
toxi

WWW
Re: Help with Image
« Reply #4 on: Jul 28th, 2003, 11:32am »

hi betaruce, please read the reference guide first to better understand the basic structure of a Processing program. setup() and loop() are explained in detail here.
 
as for drawing objects only once: you can use a draw() function which will be executed only once (to create a static image). if draw() is used, the loop() block will not be executed.  
 
if you do wish to have continuous updates, but do want to keep things drawn previously you can disable the automatic clearing of the screen by calling noBackground() within the setup() code block. in this mode you can also draw things within the setup() function...
 
re: network code - which version are you using? you didn't tell us... plus what did you try to do?
 
answers need details!
 

http://toxi.co.uk/
Betaruce
Guest
Email
Re: Help with Image
« Reply #5 on: Jul 28th, 2003, 11:45am »

Mine is 0053.
 
For the load image, I still cannot load, no matter in setup(), loop() or draw().
 
But I'm quite sure that my code is correct and the pic is in the data folder.
 
mKoser

WWW Email
Re: Help with Image
« Reply #6 on: Jul 28th, 2003, 1:12pm »

I am on 0056, and this code works:
 
 
BImage b;
 
void setup(){
  size(200,200);
  background(255);
}
 
void loop(){
  b = loadImage("bg.jpg");
  image(b,0,0);
}
 
 
I placed a picture called "bg.jpg" in the data folder, which is 200x200 pixels.
 
If you can't get i working, maybe you should try and download ver. 0056 instead?
 
...uhh, and this works aswell:
 
BImage b;
 
void setup(){
  size(200,200);
  background(255);
}
 
void draw(){
  b = loadImage("bg.jpg");
  image(b,0,0);
}
 
However, in the latter (as stated above) you cannot use the loop() method, since this is ignored as soon as you use the draw() methods!
« Last Edit: Jul 28th, 2003, 1:13pm by mKoser »  

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
Pages: 1 

« Previous topic | Next topic »