GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Processing
  • Download
  • Reference
  • Environment
  • Libraries
  • Tools
  • Wiki
  • Tutorials
  • Examples
  • Books
  • Forum
  • Overview
  • People
  • Privacy

This view

  • Original page
  • New address

GeezerVison is showing processing.org — createImage() / Reference

Reference+
Documentation→Reference→Image

Name

createImage()

Description

Creates a new PImage (the datatype for storing images). This provides a fresh buffer of pixels to play with. Set the size of the buffer with the width and height parameters. The format parameter defines how the pixels are stored. See the PImage reference for more information.

Be sure to include all three parameters, specifying only the width and height (but no format) will produce a strange error.

Advanced users please note that createImage() should be used instead of the syntax new PImage().

Examples

  • size(400,400);
    PImage img = createImage(264, 264, RGB);
    img.loadPixels();
    for (int i = 0; i < img.pixels.length; i++) {
      img.pixels[i] = color(0, 90, 102); 
    }
    img.updatePixels();
    image(img, 68, 68);
    
  • size(400,400);
    PImage img = createImage(264, 264, ARGB);
    img.loadPixels();
    for (int i = 0; i < img.pixels.length; i++) {
      img.pixels[i] = color(0, 90, 102, i % img.width); 
    }
    img.updatePixels();
    image(img, 68, 68);
    image(img, 136, 136);

Syntax

  • createImage(w, h, format)

Parameters

  • w(int)width in pixels
  • h(int)height in pixels
  • format(int)Either RGB, ARGB, ALPHA (grayscale alpha channel)

Return

  • PImage

Related

  • PImage
  • PGraphics
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.