Due: Wednesday 02/07 10:00am
GitHub link: https://classroom.github.com/a/1dLVu8y-
Makefile: Addition for 2/6
- Add a makefile .
- The makefile should be called makefile.
- Entering
make
in the command line should compile (if necessary), run the program, and display the image. - Makefile help
- The makefile should invoke whatever is needed to compile and/or run your program.
-
The makefile should then display the image, ideally, use the
display
imagemagick command. If display doesn’t work,open
should do the trick. - Basic makefile examples:
default: run
Main.class: Main.java
javac Main.java
run: Main.class
java Main
display image.ppm
default: run
run: main.py
python main.py
display image.ppm
python note: when I run python
I get python 3.x, some people have needed to use python3
instead of python
.
default: run
main.o: main.c
gcc -c main.c
picmaker: main.o
gcc -o picmaker main.o
run: picmaker
./picmaker
display image.ppm
Time for your first computer generated image:
- Create a program that generates a valid ppm image file, it should be at least 500x500, but also don’t make it too big (remember, each pixel is stored as up to 12 bytes - 3 for each color value - so a 1000x1000 image could be 12MB large, they get big fast).
- To submit the assignment, you need to click on the assignment link above. It will create a repository for you. Do all your work in that repository.
- Your repository will have 3 files in it, one in python, once in java and one in c. Each file is a small sample program that will create and write a file named image.ppm. You can either use the provided programs or make your own.
- Save, commit & push your changes to the cloned repository
- Convert your image to a png and upload it to the Graphics gallery website: http://gallery.stuycs.org
- For help with converting, you could install ImageMagick
- on ubuntu:
$ apt-get install imagemagick
- on mac:
- First install XQuartz: https://www.xquartz.org/index.html
- Follow theses instructions: https://github.com/tlk/homebrew-imagemagick-x11
- on windows… installing ubuntu and running apt-get install imagemagick will work, but there may be other options as well. WSL seems promising for many.
- For more detailed instructions (including building and installing it on your own): http://www.imagemagick.org/script/binary-releases.php
- You can also log into any stuy machine remotely, and run convert on them. * Once you’ve installed image magic, you can convert with the following command:
$ convert <source> <destination>
- example:
$ convert foo.ppm foo.png
- The destination format will be automatically set based on the file extension.
- You must submit your code via github repository and upload an image to the gallery.