Chartmaker

Samantha Zimmermann

COSC 494, Lab 3 : Jgraph

Chartmaker is a program that generates a knitting chart from a PPM file using jgraph.

Setup the repository

  1. Clone this repository
  2. Run setup script with command sh setup.sh
All set up! Make will generate 5 example images, example1.jpg - example5.jpg.

Using Chartmaker

Use the script convert.sh to easily utilize jgraph and chartmaker:
sh convert.sh <input file name> <output file name> <arguments>

This converts your input file to the specified output file and applies the arguments (outlined below). Specifying no arguments will output a chart of the same dimensions of the input file, with the same colors, and with gridlines and labels at increments of 10 across the bottom and left sides. Whatever the extension of the output file is, it will convert it to that file type. So, for example, if you specify .pdf, it will convert to PDF, and if you specify .jpg, it will convert to JPG.

Arguments

The following arguments are currently supported: Note: if you specify conflicting arguments, the program will take the most recent it has received, or the last argument specified, and ignore the previous ones.

Making your images

Here are the ways I have created PPM files that can be used reasonably with this program:

Using the executables directly

If you want to use the executables individually, you can do that as well. Chartmaker is ran with the following arguments: ./chartmaker <filename> <a/p> <arguments>

Chartmaker outputs the jgraph on standard out. To put this output into a file, you can use shell redirection and specify the name of your output file. Here's an example:
./chartmaker myfile.ppm p > myoutput.jgr

So, this converts the PPM file myfile to a jgraph file called myoutput. It will create the file myoutput.jgr if it does not exist, or if it does exist, it will overwrite it.