User Tools

Site Tools


cs276:loadingimages
/**
 * Loading Images. 
 * 
 * Loading a recent image (a weather map) from the US National Weather Service. 
 * Notice the date of the weather map - it should be today's date.
 * Processing applications can only load images from the network
 * while running in the Processing environment. This example will 
 * not run in a web broswer and will only work when the computer
 * is connected to the Internet. 
 *
 * To load a file from the local disk, copy the file into this sketch's
 * data subdirectory and pass the file name to loadImage.  An example is
 * commented out in the draw function.  Note - you can only load one image at a time.
 * 
 * Created 21 Jun 2003
 * 
 * Modified 12 Sep 2007 by SPC
 */
 
PImage img1;

void setup() {
   background(0);
   noLoop();
}

void draw()
{
  /* Uncomment the first line of code and comment the 2nd line to load an image
   * stored on disk.  The image should be in this sketch's data folder
   */

  //img1 = loadImage("image.jpg"); 
  img1 = loadImage("http://www.hpc.ncep.noaa.gov/noaa/noaa.gif");
  size(img1.width, img1.height);
  println(img1+" "+img1.height+" "+img1.width);
  image(img1, 0, 0);
}
cs276/loadingimages.txt · Last modified: 2008/09/08 16:25 by scarl