1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Artwork data

Discussion in 'iTunes & AppleScripts' started by UKenGB, Jan 24, 2016.

  1. UKenGB

    UKenGB Member

    I'm trying to export the artwork from some tracks. I can write normal jpeg (when format is jpeg) just writing to an open file, but some are png and I want to convert each and save as a jpeg. Image Events can of course perform such conversion, but I cannot make it work. I can use IE to open a png file to a variable and then save that variable as a jpeg, but when I set the variable to the data of the iTunes' track's artwork, I just get an error when I try to save.

    Is it in fact impossible to pass the iTunes' artwork data to IE and have that save it? Does IE HAVE to read in from a file and then write that out again in the specified format. Is there no way to simply pass the artwork data to IE and have it save in the specified format?
  2. DougAdams

    DougAdams Moderator Staff Member

  3. UKenGB

    UKenGB Member

    Yes I did see that Doug, but I want to be able to save an embedded PNG to JPG file and I need Image Events for that.

    I am already saving embedded JPGs ok, but one gotcha that had me stumped for a while is that it seems you HAVE to set a variable to the artworks data and then save that variable. Try and save the data directly and you get a small file of garbage. Why would you have to go via a variable in that way? Doesn't make sense to me. Also, what's the difference between 'data' and 'raw data'. I've seen many examples of using both and both seem to work the same. Why does iTunes offer both?

    I do have it all working, but I have to save a PNG image to a temporary file and then use Image Events to convert that. It does work, but seems wrong to me and that I should be able to pass the image data directly to Image Events to be saved as specified, but I just can't get that to work. Should it be possible to do this and avoid saving to a temporary file first?
  4. DougAdams

    DougAdams Moderator Staff Member

    I don't know the difference between raw data and data. I'm not sure what's wrong with creating a temp file. It's a common enough practice.

    You might gain more control using sips directly rather than the Image Events wrapper. But I don't think you'll be able to export image data in the format you want without exporting a temp first and converting it.
  5. UKenGB

    UKenGB Member

    Thanks Doug, at least I'm not missing something obvious. My next step was to look at sips and see if that offered anything.

    But I've been sidetracked by a "Can’t get «class pFix». (-1728)" when I try and run it as an application. Works perfectly otherwise and I only get the error when it's saved as an application. I don't really need it as an application, but AppleScript's Progress display basically doesn't otherwise. There I was thinking I'd finished it. :(

Share This Page