1

I want to download the image on

https://lorempixel.com/1280/320/nature/1/

with curl.

curl https://www.python.org/static/apple-touch-icon-144x144-precomposed.png > image.png works fine! (from https://stackoverflow.com/questions/32330737/ubuntu-using-curl-to-download-an-image)

The problem with https://lorempixel.com/1280/320/nature/1/ is that it has no file extension, like .jpg or .png.

Attempts:

  1. curl https://lorempixel.com/1280/320/nature/1 > test.jpg

    test.jpg

  2. curl -O https://lorempixel.com/1280/320/nature/1/

    ... Remote file name has no length! ...

  3. curl -O https://lorempixel.com/1280/320/nature/1/ > test.jpg

    ... Remote file name has no length! ...

and attempts with curl -Ov (verbose) and other attempts with no success.

Is it possible with curl?

1
  • 3
    Don't forget the last / also curl have a convinient option wich is -o to precise the output file. Anyway both works on my computer. curl https://lorempixel.com/1280/320/nature/1/ -o test.jpg
    – Kiwy
    Apr 4, 2018 at 12:30

1 Answer 1

5
$ curl -o x.jpg  https://lorempixel.com/1280/320/nature/1/ 
$ file x.jpg
x.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, comment: "CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 70", baseline, precision 8, 1280x320, frames 3
0

You must log in to answer this question.