Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Write image data to file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Write image data to file



I am looking to write image data to a file using applescript. A similar script that I have found that does this (but doesn't appear to work anymore) is iTunes Artwork to Preview from Doug's Scripts.  Does anyone have any expertise with this? 

As a test I was writing my own version of the aforementioned script. It does write the data to a file but no application opens it as a valid picture. I have included it below.


tell application "iTunes"

set playingTrack to current track

set trackArtwork to artwork 1 of playingTrack

set imageData to data of trackArtwork as picture

set blankFile to (path to desktop as string) & "picture.pict"

set fileReference to (open for access blankFile with write permission)

write imageData starting at 0 to fileReference

close access fileReference

end tell

tell application "Preview"

activate

open blankFile

end tell


---<O><O><O>---
Jesse Almanrode
Webmaster/Netcaster
www.jacomputing.net

Check out the iScript Netcast on iTunes
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.