Negative Space: Swift
- Apple goes to the Swift
-
The most exciting part of the WWDC keynote last Monday wasn‘t the new operating systems for the Macintosh and iDevices. It was the announcement of the new Swift programming language for MacOS and iOS. A new programming language is my equivalent of “one more thing…”
- Avoiding lockFocus when drawing images in Swift on macOS
-
Apple’s recommendation is to avoid lockFocus if you’re not creating images directly for the screen. Here are some examples from my own Swift scripts. You can use this to draw text into an image, and to resize images.
- Caption this! Add captions to image files
-
Need a quick caption for an image? This command-line script uses Swift to tack a caption above, below, or right on top of, any image macOS understands.
- Catalina vs. Mojave for Scripters
-
More detail about the issues I ran into updating the scripts from 42 Astounding Scripts for Catalina.
- Create searchable PDFs in Swift
-
This Swift script will take a series of image scans, OCR them, and turn them into a PDF file with a simple table of contents and searchable content—with the original images as the visually readable content.
- Create your own ASCII art palettes with densitySort
-
You can create your own ASCII art palettes from special (fixed pitch) fonts and specific collections of characters, using the densitySort script here.
- Creating searchable PDFs in Ventura
-
My searchablePDF script’s behavior changed strangely after upgrading to Ventura. All of the pages are generated at extremely low quality. This can be fixed by generating a JPEG representation before generating the PDF pages.
- ISBN (128) Barcode generator for macOS
-
Building on the QR code generator, this script uses CIFilter to generate a Code 128 barcode for encoding ISBNs on book covers.
- Place a QR code over an image in macOS
-
It's simple in Swift to create a QR code and place it over an image from your Photos or from any file on your computer.
- Text to image filter for Smashwords conversions
-
Smashwords has very strange requirements for ebooks. This script is what I use to convert books to .doc format for Smashwords, including converting tables to images.
More Information
- CIImage
-
“You use CIImage objects in conjunction with other Core Image classes—such as CIFilter, CIContext, CIVector, and CIColor—to take advantage of the built-in Core Image filters when processing images.”
- NSImage
-
“You use instances of NSImage to load existing images, create new images, and draw the resulting image data into your views.”