Skip to content

Simple Python API to download images from picsum.photo.

License

Notifications You must be signed in to change notification settings

robertopreste/pypicsum

Repository files navigation

pypicsum

Documentation Status Updates

Simple Python API to download images from picsum.photos.

Features

pypicsum can be used to download and save placeholder pictures from picsum.photos, either from the command line or from inside Python.

pypicsum allows you to:

  • retrieve images with a given width and height;
  • retrieve a random image or specify an image id;
  • retrieve grayscale images;
  • retrieve images with a given level of blur;
  • combine the above options to your desire.

Installation

PLEASE NOTE: pypicsum only supports Python 3!

The preferred installation method for pypicsum is using pip:

$ pip install pypicsum

For more information, please refer to the Installation section of the documentation.

Usage

Please refer to the Usage section of the documentation for an extensive usage coverage.

Command Line Interface

To download a random image and save it locally, just run:

pypicsum

A random 500x500 px image will be retrieved from picsum.photos and saved locally with a random name, in png format. Additional options can be used to specify width and height, image id (to retrieve a specific image instead of a random one), grayscale, blur level, path and file format to save the image.

Python Module

The Picsum class can be used to retrieve images from picsum.photos in a Python program:

from pypicsum import Picsum
pic = Picsum()

An empty Picsum() instance call will retrieve a random 500x500 px image, but it is possible to use additional arguments to specify more details. The .save() method allows to save the picture, optionally providing a specific path and file format:

pic.save("my/folder/pic01", ext="jpg")

Credits

This package was created with Cookiecutter and the cc-pypackage project template.

About

Simple Python API to download images from picsum.photo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published