2017-11-20

posted Nov 20, 2017, 6:15 AM by Konstantinovich Samuel   [ updated Nov 20, 2017, 6:16 AM ]
Goal: Image manipulation using patches:

10 minutes of presentations.

1. import-pcolors  - loads a predetermined image file by setting patches to that color

Demo Code here:

Create a netlogo file with the following setup:

to setup
  ca
  reset-ticks
  import-pcolors "pencils.jpg"
end

BEFORE YOU DO ANYTHING:
Important: You must save the netlogo file and the image file in the same directory! 
This is especially important if you don't really know what directory you place things in. Downloading a file you should "SAVE AS" and make sure you know where it goes. For images, you can right click save as.

BEFORE you write code: Discuss with your neighbors and write in your notes 1-2 sentences for each: 2 and 3. 
2. (Write) Try to shift the image downwards. How can we do this?
3. (Write) Make the image grayscale. Think: Open the color swatch, what does a grayscale image look like in terms of pcolor values?
4. Store the original color in a variable in setup, then make a reset function that restores the original color. This is MUCH faster than importing a second time.
    This can be done in the setup, and again using a save / load button.

Get the files here (if you are at school)
file:///home/support/konstans/public/pencils.png
file:///home/support/konstans/public/pusheen.jpg

Comments