NetLogo banner

Home
Download
Help
Forum
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

Image Import Example

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web

WHAT IS IT?

This code example shows how to use, and the differences between, the import-pcolors, import-drawing, and import-pcolors-rgb primitives.

Agents cannot sense the drawing, so they cannot interact with or process images imported by import-drawing. If you need an image agents can sense, you must use import-pcolors or import-pcolors-rgb.

HOW TO USE IT

Select the sample image you want to import with the FILENAME chooser, and then press either button below the chooser.

If you want to use your own image file, use the buttons that use user-choose-file to let you pick a file.

THINGS TO NOTICE

The drawing appears in front of the patch colors.

Images imported by import-pcolors and import-pcolors-rgb are scaled to fit the world. The colors when using import-pcolors may be distorted since NetLogo supports only a limited color set for pcolor values. When using import-pcolors-rgb the colors will be set to three-item RGB lists. See the Color section of the Programming Guide in the NetLogo User Manual for information on colors in NetLogo.

THINGS TO TRY

Try loading the different images into the patches to get an idea of the type of color distortion to expect.

Try importing an image with import-pcolors and then import the same image with import-drawing and import-pcolors-rgb. How does handling of the image differ?

(back to the NetLogo Models Library)