Lucien S.
Lucien S.

Reputation: 5345

How to download an image from url to use in Photoshop scripting (ExtendScript Toolkit)

In my Photoshop javascript (using ExtendScript toolkit), I need to download an image before processing it. I'm trying with wget, as such:

app.system("wget https://dl.dropboxusercontent.com/u/73950/IMG_1827%20%282%29.png > ~/Desktop/test.png");

Unfortunately, this produces an empty png file.

What's the correct way to download files from url when scripting with Photoshop?

Upvotes: 1

Views: 3265

Answers (2)

Valerii Leykin
Valerii Leykin

Reputation: 39

It's working only for Mac, below is the way for both:

if ( Folder.fs.indexOf("Win") > -1 ) {//SYSTEM IS ONE OF THE WINDOWS
    app.system("cmd.exe /c \"bitsadmin /Transfer myDownloadJob " + imageUrl + " " + localImgPath + "\"");
}else{
    app.system("curl -o " + localImgPath + " " + imageUrl);
}

Upvotes: 0

fabianmoronzirfas
fabianmoronzirfas

Reputation: 4131

Tried your wget command without luck. But it worked with curl for me.

app.system("curl -o ~/Desktop/test.png https://dl.dropboxusercontent.com/u/73950/IMG_1827%20%282%29.png")

Upvotes: 5

Related Questions