开发者

How to Process HTTP Response to Obtain Image Content

开发者 https://www.devze.com 2023-02-22 12:54 出处:网络
I\'m trying to integrate a web service that serves PNG images into Photoshop using JSX/ExtendScript. To accomplish this, I create a Socket (TCP) and write the user configurable parameters in the GET r

I'm trying to integrate a web service that serves PNG images into Photoshop using JSX/ExtendScript. To accomplish this, I create a Socket (TCP) and write the user configurable parameters in the GET request. The server then returns an HTTP response, which I have been able to read line by line, to verify that it has the correct Header information (eg, Content-Type: image/png开发者_如何转开发). However, I'm at a loss as to how to process the HTTP response in order to get some type of image data that can be pasted into a Photoshop ArtLayer. As of now, when I process it as ASCII, all I see is that the ninth or tenth line has "██PNG███", which is where I assume the data starts.

Anyone have any idea how to accomplish this? Is there perhaps an existing JavaScript library that could handle such processing? As far as I can tell, the Photoshop and ExtendScript libraries are rather limited in this respect.

Update

I still haven't figured this out. However, I instead ended up making a Creative Suite Extension in AIR (using Flash Builder + Creative Suite SDK), which was much simpler and integrates into Photoshop (and Illustrator and In-Design ...) much better than I think the script would have anyway. Flex already has URL resource loaders, and I used AIR in particular so that I could push content onto the clipboard, which could then be copied/dragged into a layer.

I would still like to know how this could have been done with a JSX script, as I think it is possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号