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.
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
- Find all parent mailboxes in macOS Mail
- The macOS Mail app seems to want to hide the existence of mailboxes and any sense of hierarchical storage. These two AppleScripts will help you find the full path to a selected message and open the message’s mailbox.
- JXA and AppleScript compared via HyperCard
- How does JXA compare to the AppleScript solution for screenshotting every card in HyperCardPreview?
- Using version control with AppleScripts
- AppleScripts aren’t stored as text, which makes it impossible to track changes in AppleScript files using version control software such as Mercurial or Git.
- Save clipboard text to the current folder
- Use the Finder toolbar to save text on the current clipboard directly to a file in the folder that Finder window is displaying.
- Adding parenthetical asides to photograph titles on macOS
- Use Applescript to append a parenthetical to the titles of all selected photographs in Photos on macOS.
- 17 more pages with the topic AppleScript, and other related pages
More GraphicConverter
- Astounding Scripts on Monterey
- Monterey removes Python 2, which means that you’ll need to replace it if you’re still using any Python 2 scripts; there’s also a minor change with Layer Windows and 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.