Generating High Quality Output
23 September, 2020
Working with the Animation project, you can generate static output from the provided playground file:
On a non-Retina Mac, a canvas declared to be 500x500 in size will actually be generated as a 500x500 image. On a Retina Mac, the generated image will be twice as large, 1000x1000.
// Create canvas let preferredWidth = 500 let preferredHeight = 500 let canvas = Canvas(width: preferredWidth, height: preferredHeight)
In either case, to print an image on a physical medium like paper or a transparency, a higher resolution is required.
For example, for the code above, a high-resolution image can be generated by adjusting the end of this line to read:
let canvas = Canvas(width: preferredWidth, height: preferredHeight, quality: .Ultra)
Now, the generated image at "ultra" quality will be four times as large in each dimension. This is sufficient to print an image and have the result be crisp.
NOTE: You'll notice the sketch takes longer to generate with an "ultra" quality canvas. As such, you should only use that setting when you are trying to generate an image for printing. In all other cases, use the "standard" quality.
To obtain the image file, add the following line of code at the end of the other code that creates your drawing:
Open the Preview program on your computer. Then press Command-N. You will then see the new image. Press Command-S to save your image.
You can then do what you like with the image file. Have fun!