Page 1 of 1

Download and Open Web Image In Photoshop

Posted: Mon Feb 11, 2019 11:46 am
by AnilTejwani
Hi,

Is it possible to download and open an web-image in photoshop?

Example if I do this *manually* it works

i. Open Photoshop,
ii. click file-> open
iii. paste the web image url ( example 'https://tejwani.com/wp-content/uploads/ ... de1-01.jpg' )
it takes a while but open the file in photoshop [it downloads in windows cache(I am on Windows) and opens it].

I am not able to script the same thing.
Example the code below

Code: Select all


  var fName = 'https://tejwani.com/wp-content/uploads/2018/02/slide1-01.jpg';
var thisFile = File(fName);
app.open(thisFile);

Any ideas or work around?

Thanks in advance

Re: Download and Open Web Image In Photoshop

Posted: Tue Feb 26, 2019 1:11 pm
by joonaspaakko
Pasting the image into Photoshop is quite different from that code example. When you're copying the image, you're not copying the image url, but the image itself. When you finally paste it into Photoshop, it simply takes what is in the clipboard and places it in the document. So it's not photoshop that downloads the image.

Edit: I realized now that you explicitly said you paste the url into PS. That's not a PS feature I'm aware of. Is this possibly something they introduced in a recent CC update?

That said, I found this on stackoverflow:

Code: Select all


app.system("curl -o ~/Desktop/test.png https://placekitten.com/200/300")

Here's some more discussion about that method/post from stackoverflow.

So you should be able to do something like this:

Code: Select all


var file = new File('~/Desktop/kitty.jpg');
app.system("curl -o "+ file.fsName +" https://placekitten.com/200/300");
app.open( file );
file.remove();

Re: Download and Open Web Image In Photoshop

Posted: Tue Mar 05, 2019 4:55 am
by AnilTejwani
joonaspaakko wrote: ↑Tue Feb 26, 2019 1:11 pm Here's some more discussion about that method/post from stackoverflow.
So you should be able to do something like this:

Code: Select all


var file = new File('~/Desktop/kitty.jpg');
app.system("curl -o "+ file.fsName +" https://placekitten.com/200/300");
app.open( file );
file.remove();
That did it. Thanks a lot for your help.

Re: Download and Open Web Image In Photoshop

Posted: Mon Mar 28, 2022 6:23 am
by z3597666
Is there any way not jump out of the CMD