When Unsplash API https://api.unsplash.com/photos/?client_id=#{dummy_client_id} is called it returns JSON in the following format
[
{
"id": "kmTq5GU6c-0",
"created_at": "2019-05-27T14:07:14-04:00",
"updated_at": "2020-08-21T01:25:29-04:00",
"promoted_at": null,
"width": 5472,
"height": 3648,
"color": "#FFFFFF",
"description": null,
"alt_description": "man riding black motorcycle",
"urls": {
"raw": "https://images.unsplash.com/photo-1558980394-da1f85d3b540?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEzMDkxNX0",
"full": "https://images.unsplash.com/photo-1558980394-da1f85d3b540?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjEzMDkxNX0",
"regular": "https://images.unsplash.com/photo-1558980394-da1f85d3b540?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEzMDkxNX0",
"small": "https://images.unsplash.com/photo-1558980394-da1f85d3b540?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjEzMDkxNX0",
"thumb": "https://images.unsplash.com/photo-1558980394-da1f85d3b540?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&ixid=eyJhcHBfaWQiOjEzMDkxNX0"
},
"links": {
"self": "https://api.unsplash.com/photos/kmTq5GU6c-0",
"html": "https://unsplash.com/photos/kmTq5GU6c-0",
"download": "https://unsplash.com/photos/kmTq5GU6c-0/download",
"download_location": "https://api.unsplash.com/photos/kmTq5GU6c-0/download"
},
"categories": [
],
"likes": 409,
"liked_by_user": false,
"current_user_collections": [
],
"sponsorship": {
},
"user": {
}
}
]
I need to download the image and unsplash guidelines states that you need to use links['download'] to download the image. The downloaded image is always of size greater than 4MB.
How can I download the image of smaller size/ width/ height. ?