[img x y]
[img x y c d]
Displays images to the screen. Processing currently works with GIF, JPEG, and Targa images. The color of an image may be modified with the tint function and if a GIF has transparency, it will maintain its transparency. The img parameter specifies the image to display and the x and y parameters define the location of the image from its upper-left corner. The image is displayed at its original size unless the width and height parameters specify a different size. The image-mode fn changes the way the parameters work. A call to (image-mode :corners) will change the width and height parameters to define the x and y values of the opposite corner of the image. Starting with release 0124, when using the default (JAVA2D) renderer, smooth will also improve image quality of resized images.
[mode]
Modifies the location from which images draw. The default mode is :corner. Available modes are: :corner - specifies the location to be the upper left corner and uses the fourth and fifth parameters of image to set the image's width and height. :corners - uses the second and third parameters of image to set the location of one corner of the image and uses the fourth and fifth parameters to set the opposite corner. :center - draw images centered at the given x and y position.
[filename]
Loads an image into a variable of type PImage. Four types of images ( .gif, .jpg, .tga, .png) images may be loaded. To load correctly, images must be located in the data directory of the current sketch. In most cases, load all images in setup to preload them at the start of the program. Loading images inside draw will reduce the speed of a program. The filename parameter can also be a URL to a file found online. If an image is not loaded successfully, the null value is returned and an error message will be printed to the console. The error message does not halt the program, however the null value may cause a NullPointerException if your code does not check whether the value returned from load-image is nil. Depending on the type of error, a PImage object may still be returned, but the width and height of the image will be set to -1. This happens if bad image data is returned or cannot be decoded properly. Sometimes this happens with image URLs that produce a 403 error or that redirect to a password prompt, because load-image will attempt to interpret the HTML as image data.
[img mask]
[mask]
Masks part of an image from displaying by loading another image and using it as an alpha channel. This mask image should only contain grayscale data, but only the blue color channel is used. The mask image needs to be the same size as the image to which it is applied. If single argument function is used - masked image is sketch itself or graphics if used inside with-graphics macro. If you're passing graphics to this function - it works only with :p3d and :opengl renderers. This method is useful for creating dynamically generated alpha masks.
[]
Removes the current fill value for displaying images and reverts to displaying images with their original hues.
[filename]
This function load images on a separate thread so that your sketch does not freeze while images load during setup. While the image is loading, its width and height will be 0. If an error occurs while loading the image, its width and height will be set to -1. You'll know when the image has loaded properly because its width and height will be greater than 0. Asynchronous image loading (particularly when downloading from a server) can dramatically improve performance.
[r g b]
[rgb alpha]
[rgb]
[r g b a]
Sets the fill value for displaying images. Images can be tinted to specified colors or made transparent by setting the alpha. To make an image transparent, but not change it's color, use white as the tint color and specify an alpha value. For instance, tint(255, 128) will make an image 50% transparent (unless colorMode() has been used). The value for the parameter gray must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255. Also used to control the coloring of textures in 3D.
[gray]
[r g b]
[r g b a]
[gray alpha]
Sets the fill value for displaying images. Images can be tinted to specified colors or made transparent by setting the alpha. To make an image transparent, but not change it's color, use white as the tint color and specify an alpha value. For instance, tint(255, 128) will make an image 50% transparent (unless colorMode() has been used). The value for the parameter gray must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255. Also used to control the coloring of textures in 3D.
[rgb alpha]
[rgb]
Sets the fill value for displaying images. Images can be tinted to specified colors or made transparent by setting the alpha. To make an image transparent, but not change it's color, use white as the tint color and specify an alpha value. For instance, tint(255, 128) will make an image 50% transparent (unless colorMode() has been used). The value for the parameter gray must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255. Also used to control the coloring of textures in 3D.