Lorem Picsum -The Lorem Ipsum for photos

lorem ipsum for pictures

While developing user interface applications if the actual text content is not available, we use dummy text to check formatting and presentation which looks similar to the actual context. The dummy text used for testing formatting is called Lorem Ipsum. Some websites provides free service to generate Lorem Ipsum. Find more information about Lorem Ipsum and generate random text from here

Similarly, when we want to use a dummy image when the actual image is not available, we have to download an image from the internet and resize it as per our needs. If your application uses a lot of images with different sizes then the process becomes laborious.

Fortunately, just like Lorem Ipsum, picsum phots ( https://picsum.photos/) website provides a random image for free with a given size. In fact all the images you are viewing for this blog post generated from the same service. I am using a service which generates random image . So every time you open this blog post you might see a different image.

If you want to generate a random image with 800 x 600 size just use the following URL

Code language: Java (java)
lorem ipsum random image from picsum.photos

If you are using the same URL at more than one place then images might get cached, you can avoid caching adding a random parameter to URL

Code language: Java (java)
lorem ipsum random image from picsu.photos

for displaying a random square image use below URL

Code language: Java (java)
lorem ipsum random square image from picsum.photos

If you want to always display the same image, picsum website also provides options to get a specific image using below URL format. You can get all the available image ids here

Code language: Java (java)

You can get same image every time using below URL

Code language: Java (java)
lorel picsum image of size 800 x 600 with id 1 from picsum.photos

The website also provides options to get greyscale images, list of images and image info.

Similar Posts