Skip to main content

Create image galleries with Sphinx

Project description


Create image galleries with Sphinx. No external JS dependency.


If you’re using a virtualenv, just:

pip install sphinx-galleria


Your webserver must deliver .mjs file with correct content type (application/javascript).


Add ‘sphinx_galleria’ in the list of extensions in your source.conf file.

Just use the galleria directive like this:

.. galleria:: imagefile1 imagefile2  images*.jpg
   :galleria: (optional) Name of gallery - node level
   :alt: (optional) A long description - image level
   :title: (optional) Title of image - image level
   :thumbsize: (optional) Image size (defaults to "100x100") - image level
   :width: Width of image (in pixel or percentage or with unit, default auto) - node level
   :height: (optional) Height of image (in pixel or with unit) - node level
   :align: Align to 'right', 'left' or 'center' (default to center) - node level
   :hide_title: Flag - hide title under image (not in dialog) - image level
   :hide_alt: Flag - hide alternative text under image - image level
   :no_transition: Flag - avoid transition effect - node level
   :timer: (optional) Go to next image each timer seconds
   :class: (optional) HTML class for gallery - node level

Image level options are same for all images defined by the directive. If you need separated descriptions and titles, just use the directive several times with the same galleria name. In this case, node level options must be defined only once.

Thumbnail size is in “WIDTHxHEIGHT” format, resulting image keeps ratio. Be careful with tumbnail size, the browser loads all thumbnails of a gallery when loading the page. It can take some time with really big galleries.

The first image of a gallery is displayed if javascript is not available on the browser.


sphinx-galleria is under EUPL-1.2.


1.1.0 (2021-08-03)

  • Better compatibility with mobile phones and small screens
  • Swipe support
  • More space for images
  • Restructure repository
  • Use initial format instead of PNG for thumbnails

1.0.3 (2021-07-13)

  • Fix height on prev/next buttons

1.0.2 (2021-07-13)

  • Fix scroll computation
  • Translation of ignored elements
  • Improve accessibility

1.0.1 (2021-06-03)

  • Fix translation
  • Add timer option
  • Better CSS and transition

1.0.0 (2021-05-28)

  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_galleria-1.1.0.tar.gz (34.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page