Copying album art with GraphicConverter
I have not owned a scanner, ever. Back when it would have been useful, I couldn’t afford one, and now that I can afford one, most everything is already digital. The one place where a scanner would be useful is copying album art from vinyl for iTunes.
What I’ve ended up doing is taking a digital photo of the album and—at first—trying very hard to take it so that the album cover was square enough for cropping. Once I discovered GraphicConverter’s Unskew1 function, squaring album covers became a lot easier. Unskew lets me specify the four corners of the album cover so that GraphicConverter can square it for me. I no longer have to worry about taking a perfectly-oriented photo of each album.
Align the corners of the unskew box with the corners of the album, and GraphicConverter will unskew the album cover.
After I square the album cover, there are a series of steps that I always take. I autolevel the image, scale it to a standard width, copy it, and then close the window. This is, of course, a mini-workflow, and should be able to be automated.
[toggle code]
-
tell application "GraphicConverter"
-
tell window 1
- --manually make sure tolerance is .2%
- autolevel
- --scale to 800 pixels wide
- set imageRect to image dimension
- set width to the first item of imageRect
- set scaleFactor to 800 / width
- scale horizontal scaleFactor vertical scaleFactor
- --select all and copy
- set imageRect to image dimension
- set width to the first item of imageRect
- set height to the last item of imageRect
- set selection to {0, 0, width, height}
- copy
- close without saving
- end tell
-
tell window 1
- end tell
The only problem with this script is that GraphicConverter doesn’t support including the desired tolerance with the autolevel command. I’ve found that .2 is a good choice for tolerance; I just have to make sure that whenever I change it for some other purpose, I always change it back to .2 before using this script.
The image dimension is a list of two numbers: the width and the height. Since I’ve decided that I want to standardize on 800 pixels wide, I get the first item from the image dimension, divide it into 800, and then scale the image both horizontally and vertically by that scale factor.
After autoleveling and scaling, I need to copy the image; the dimensions have changed, so I get the image dimension again, then set the selection to be the entire image: from 0 to width, and from 0 to height. Then, copy it and close it.
Now that it’s in the clipboard, I can go into iTunes and select whatever tracks it applies to and paste it in as album art.
You can store this script in the standard script folder if you have the “Script menu” enabled2, in ~/Library/Scripts/Applications/GraphicConverter/ as, for example, “Copy Album Cover”. You can also store it in GraphicConverter’s own scripts folder; as far as I can tell it works the same in either location.
“Unskew (Set Proportions)…” under the “Effect” menu. Or Command-Control-E.
↑Use AppleScript Editor’s General Preferences to “Show Script menu in menu bar”.
↑
- GraphicConverter: Thorsten Lemke
- GraphicConverter allows you to take pictures from just about any source and turn them into gifs or jpegs that you can use on the net. You can modify them in numerous ways, and even create them from scratch. If you’re a programmer, you can create your own ‘plug ins’. It supports animated GIFs, quicktime movies, and the PNG graphic format. It can convert between most graphic formats you are ever likely to run across—even the old TRS-80 graphics.
More AppleScript
- AppleScript Preview in Snow Leopard and Lion
- Preview supports AppleScript, but the support is turned off by default. You can enable it with three terminal commands.
- Apple Mail on the Desktop with GeekTool
- Here’s a simple AppleScript to use with GeekTool to put your inbox on the Desktop.
- Stack windows on top of each other
- If you want to stack multiple windows directly on top of each other, it’s easy to do in any well-behaved application, such as Nisus Writer Pro, Safari, Mail, and even older applications like AppleWorks 6 and Microsoft Word X.
- Getting the selected playlist in iTunes
- It took a while to figure out how to get iTunes’s selected playlist as opposed to the current playlist in AppleScript.
- Converting FileMaker to Django
- Appscript and the Django API make it easy to transfer data from Mac OS X scriptable applications into a Django-powered database.
- 10 more pages with the topic AppleScript, and other related pages
More GraphicConverter
- Using AppleScript with GraphicConverter
- Automatically trim an image to a set size, set the appropriate transparent color, and then save and upload a png and gif version of the image.
More vinyl
- Pac-Man Fever
- I was wandering around the record stores a couple of years ago when I saw a full-length album called “Pac-Man Fever”. I vaguely recognized the title, but knew it only as a single. Could I resist buying an album of songs about eighties arcade games? Of course not.
- Importing vinyl into iTunes
- This script takes songs split by marker from SoundStudio and converts them directly into iTunes, setting track number, track total, and album name along with the song title.
