Re: Save image from raw data class variable
Re: Save image from raw data class variable
- Subject: Re: Save image from raw data class variable
- From: Brian Johnson <email@hidden>
- Date: Thu, 17 Mar 2005 09:12:35 -0800 (PST)
On Thu, 17 Mar 2005, Kirill Kortchagin wrote:
On ??? 17, 2005, at 14:09, jj wrote:
I getting a track artwork from iTunes as <<data
PICT36D40...bla-bla-bla...>> and I need to save it in file.
How I can do that? Does exists any solutions with a shell commands or
an additions?
Aha-pupok
email@hidden
http://www.yezhe.ru/applescript/
You can simply write the data to a PICT file. Eg:
#################
tell application "iTunes" to ¬
set pictData to data of artwork 1 of track 1 of playlist 1
set outputFile to (choose file name default name "artwork.pict")
do shell script "touch " & quoted form of POSIX path of outputFile
set fref to (open for access outputFile with write permission)
set eof of fref to 0 --> empty file if needed
write pictData to fref
close access fref
#################
Thanks! It work!
Before it I saw the JPEG signature or the PNG signature in the text of
written files and I tried to save and to open it as the JPEG or PNG file
respectively. ;)
If, in fact, you want this image to be served on the web you'll need to
convert it to one of those. To do this you could use something like the
following snippet with GraphicConverter (assuming p contains the PICT
image)::
set the clipboard to p
tell application "GraphicConverter"
set xw to new image from clipboard without messages
save xw in filename as GIF with wwwready and replacing without messages
close window 1 without saving
end tell
- Brian Johnson, dept of archtiecture, university of washington
(feeling young today, being just the high side of semi-centarian)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden