1. Get a random picture of the specified size
Rectangular picture:
1 | https://picsum.photos/100/200 |
This results in a random image with a width of 100 and a height of 200.
Square image:
1 | https://picsum.photos/200 |
equivalent to
1 | https://picsum.photos/200/200 |
This will get a random square image with a width of 200 and a height of 200
2. Get the picture with the specified ID
1 | https://picsum.photos/id/123/200/500 |
3, static random pictures
Each time, the same random image is obtained according to the seed, by adding /seed/{seed} in front of the parameter, and seed is the seed of the image, such as test.
1 | https://picsum.photos/seed/test/300 |
4. Grayscale image
To get a grayscale image, you need to add the following parameters:
grayscale
1 | https://picsum.photos/200/300?grayscale |
5. Blur image
To get the blurred image, need ?blur to the end of the url to get the blurred image.
1 | https://picsum.photos/200/?blur |
The amount of blur can also be adjusted by providing a number between 1 and 10.
1 | https://picsum.photos/200/?blur=2 |
6, advanced usage
6.1, mixing parameters
In practice, any of the above options can be mixed.
For example, to obtain a square image with grayscale, blur amount of 2, ID of 999, and side length of 200.
1 | https://picsum.photos/id/999/200?grayscale&blur=2 |
6.2, multiple pictures
If you want to request multiple images of the same size in the browser, you need to add the random query parameter to prevent the images from being cached by the browser:
Comment first then view it after your comment is approved. Join QQ Group to display all hidden texts.
6.3. Specify the format
You can also add image extensions such as .jpg or .webp at the end to return images in the corresponding format.
1 | https://picsum.photos/200/300.jpg https://picsum.photos/200/300.webp |
6.4, list pictures
can use
1 | https://picsum.photos/v2/list |
to get a list of images.
Example of return value:
1 | [ { "id": "0", "author": "Alejandro Escamilla", "width": 5616, "height": 3744, "url": "https://unsplash.com/...", "download_url": "https://picsum.photos/..." } ] |
By default, the API will return 30 items per page.
To specify list page numbers, use
?page
To change the number of items per page, use
?limit
1 | https://picsum.photos/v2/list?page=2&limit=100 |
6.5. Image details
can use
1 | https://picsum.photos/id/{id}/info |
Get information about a specific image.
The ID of an image can be obtained by looking at the Picsum-ID header or fields in the User Comment EXIF metadata.
Example of return value:
1 | { "id": "0", "author": "Alejandro Escamilla", "width": 5616, "height": 3744, "url": "https://unsplash.com/...", "download_url": "https://picsum.photos/..." } |
Lorem Picsum : High Quality Gallery
Comments