stevejobsfan0123

Q: Fetch album artwork with AppleScript

Goodness gracious, there are more properties for a track in the iTunes .sdef than I could ever imagine. However, one that is notably absent is the album artwork. Since this is not directly a property, is there some other way I can retrieve a track's album artwork?

Posted on Sep 12, 2016 10:43 AM

Close

Q: Fetch album artwork with AppleScript

  • All replies
  • Helpful answers

  • by Camelot,Solvedanswer

    Camelot Camelot Sep 12, 2016 11:03 AM in response to stevejobsfan0123
    Level 8 (47,285 points)
    Mac OS X
    Sep 12, 2016 11:03 AM in response to stevejobsfan0123

    Artwork is an element of a track, not a property. Tracks can have multiple pieces of artwork, each of which has its own set of properties.

     

    It's pretty trivial to obtain, though:

     

    tell application "iTunes"

      set myArtwork to every artwork of track 1 of playlist "Music"

    end tell

     

    Once you have that, you can parse the data however you want. For example, to extract the JPEG image, you can:

     

    tell application "iTunes"

      set myArtwork to first artwork of track 1 of playlist "Music"

      if format of myArtwork is JPEG picture then set myPicture to data of myArtwork

    end tell

  • by stevejobsfan0123,

    stevejobsfan0123 stevejobsfan0123 Sep 12, 2016 11:04 AM in response to Camelot
    Level 8 (43,718 points)
    iPhone
    Sep 12, 2016 11:04 AM in response to Camelot

    Thank you, I knew I was overlooking something simple.