writing to standard output as a file?

I’m using applescript to get track information from iTunes, but am having trouble with the track artwork.

I have figured out how to write the artwork to a file, but would prefer if all of the file data was sent to the standard output (stdout) instead for use in the osascript tool, so as to integrate with another application that is not applescript aware. I was able to find this post, which uses a bash script wrapper around an applescript in what appears to be an attempt to write to /dev/fd/1 to get the same effect:


but both that and my adaptation of it it keep throwing error -1407, and says it cannot find /dev/fd/1, although I can see it just fine…

Evaluating the data of the artwork as the last statement in my script has already been tried, but it seems that instead of giving me raw data, it all comes out as a hex-dump wrapped in a <<data[…]>>, which I assume is trying to be user-readable. I would like to avoid having to strip the wrapper and convert to binary.

Any help would be greatly appreciated.