Lorem Picsum : High Quality Gallery

1. Get a random picture of the specified size

Rectangular picture:

code
1
https://picsum.photos/100/200


This results in a random image with a width of 100 and a height of 200.

Square image:

code
1
https://picsum.photos/200

equivalent to

code
1
2
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

code
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.

code
1
https://picsum.photos/seed/test/300

4. Grayscale image

To get a grayscale image, you need to add the following parameters:

grayscale
code
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.

code
1
https://picsum.photos/200/?blur


The amount of blur can also be adjusted by providing a number between 1 and 10.

code
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.

code
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.

code
1
2
https://picsum.photos/200/300.jpg
https://picsum.photos/200/300.webp

6.4, list pictures

can use

code
1
https://picsum.photos/v2/list

to get a list of images.

Example of return value:

json
1
2
3
4
5
6
7
8
9
10
[
    {
        "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
code
1
https://picsum.photos/v2/list?page=2&limit=100

6.5. Image details

can use

code
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:

json
1
2
3
4
5
6
7
8
{
        "id": "0",
        "author": "Alejandro Escamilla",
        "width": 5616,
        "height": 3744,
        "url": "https://unsplash.com/...",
        "download_url": "https://picsum.photos/..."
}

Lorem Picsum : High Quality Gallery

https://blog.tsinbei.com/en/archives/25/

Author
Hsukqi Lee
Posted on

2022-01-15

Edited on

2022-07-28

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet