gallery_maker
Make an html file for an image gallery.
See example html files generatied using gallery maker: Fru Jensen and posters2022.
For the simplest use, navigate to a folder with images and run gallery_maker. This will fint images (jpg, png or gif) and create a html file of a gallery with images. Images may be either directly in the folder or in one subfolder.
SETUP
Either install the package from PyPI with pip install gallery-maker or install from source with the following steps
DEPENDENCIES
Making gallery has no dependencies.
A helper function for image processin is included, and it has dependencies, where you can add, what you need:
- Basic image processing uses Pillow.
- Converting pdf to images (only onepagers supported) uses pdf2image, which requires installing popler, as explained at pdf2image page.
- Converting heic images uses pillow_heif.
USAGE
As Python module:
import galmak as gm
# Without image conversion, using default settings
path = 'path/to/images'
gm.make_gallery(path)
# With image conversion, using a few custom settings
path = 'path/to/images'
folder_out = 'path/to/output'
gm.fix_images(path, folder_out, max_size=2000, to_ext='.jpg')
gm.make_gallery(folder_out)
Look up docstrings of make_gallery and fix_images for more details.
From command line.
For default behaviour navigate to a folder with images and run
gallery_maker
to create an html file with a gallery of the images. Images may be either directly in the folder or in one subfolder.
For custom behaviour use the following options:
--photos_folderstring, a path to the folder containing photos. If ending with '/' at the end, the html document is placed inside the photos_folder. Otherwise, the html document is placed in the top folder where photos_folder is placed.--nr_columnsinteger 1, 2, 3, or 4. Number of columns for the image grid. Defaults to 4.--clickableboolean. Whether clicking on the image yields a true-size preview of the image. This is useful when images are (natively) large and details can't be seen in scaled previews used for the image grid. Defaults toTrue.--filenamestring. Filename with html extension. Don't include the path. The path is extracted from photos_folder. Defaults to 'gallery.html'.--window_titlestring. Shorter text used in browser tabs. Defaults to 'Gallery'.--gallery_titlestring. The title of the gallery displayed in html page. Defaults to 'MY GALLERY'.--footer_textstring. The text placed below the gallery. Defaults to 'Made by gallery_maker.py.'.
Specifying any of the following options will trigger image conversion before creating the gallery. The converted images will be saved in a subfolder of the folder the gallery, named _processed_. In this case, the original images are not used in the gallery.
--from_extstring. A string listing extension of the images to be converted. It should be space-separated and enclosed in quotes. Example:--from_ext ".jpeg .jpg .png .gif". Defaults to".jpeg .jpg .png .gif". Also supported are.pdfand.heic, but these require additional dependencies.--to_extstring or None. Extension used when saving. If None, the original extension is used.--max_sizeint or None. Maximal size of (any) image side. Defaults to None which keeps original image dimension.--to_extto specify the extension of the converted images. If None, the original extension is used as much as possible, butjpgis used forpdfandheicimages. Defaults to None.--name_asstring or None. The root of the image names if images are to be renamed. Defaults to None which keeps original image names.
Example:
gallery_maker --nr_columns 3 --clickable False --filename my_gallery.html --window_title "Summer photos" --gallery_title "Summer holiday" --footer_text " " --from_ext ".jpeg .heic"
SUPPORTED IMAGE FORMATS
The following image formats are supported: jpeg, jpg, png, gif, pdf (requires pdf2image and poppler), heic (requires pillow_heif).
KNOWN ISSUES
The library for reading heic images seems not to be working if I use code from the command line. It works fine if I use the same code in a script. I don't know why, it has something to do with module/package loading, so it might work for you.
Metadata
Release files for gallery-maker 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gallery_maker-0.0.1.tar.gz | 19.1 kB | Without provenance | Details for gallery_maker-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gallery_maker-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for gallery_maker-0.0.1-py3-none-any.whl |
Total release size: 38.9 kB
Release files / gallery_maker-0.0.1.tar.gz
| Download URL | gallery_maker-0.0.1.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1e30256918ddfd8dcf8c0738d986b1b881afc07615b529950ff9c7537840d1e
|
|
BLAKE2b-256 checksum How to use checksums |
f1ab9bbc80a531a9b3ebe978dbd12c10d30886effdfd16e2900251af6bc556ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / gallery_maker-0.0.1-py3-none-any.whl
| Download URL | gallery_maker-0.0.1-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83e5417d136049593d57bcad59fecfa88af0ca2c9a9541b42f99c1afd2beff36
|
|
BLAKE2b-256 checksum How to use checksums |
6bd003456884dbfaaa91dd7d6eb02d3c1a8bc194581546a8d92e901a6b52ceea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for gallery-maker 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.