Skip to main content

Takes Google Photos Album (visible to anyone with url) and produces a zip file with compressed JPEGS.

Project description

For more information about the author, visit LinkedIn.

Python Package - gPhotosAlbum_JPEGcompression

Overview

Short Description: Takes Google Photos Album (visible to anyone with url) and produces a zip file with compressed JPEGS.

USP:

  • The JPEGS retain the metadata.
  • 1.5x to 15x reduction in file size depending on the JPEG.
  • Larger files with higher megapixel undergo very good compression.
  • Almost perfect image clarity up to 250% magnification.

Release Notes

version 2.1.7

  • Big update, switched to using selenium web driver automation.
  • Auto config selenium, no need to lift a finger.
  • Include some additional tweaks and optimizations.

version 1.4.3

  • Some fixes (as always).

version 1.4.2

  • First public release of gPhotosAlbum_JPEGcompression.
  • JPEGS retain metadata.

Installation

You can install the package using pip:

pip install gPhotosAlbum_JPEGcompression

Methods

1. Simple usecase.

Takes the Google Photos Album url as Input. Ensure that the Photos are set to "Accesible by anyone with the url".

Returns: A zip file of the compressed images (JPEGs).

from gPhotosAlbum_JPEGcompression import compress_GoogleAlbum_jpeg


googleAlbumURL = "https://photos.app.goo.gl/loremimpsunm56"

compress_GoogleAlbum_jpeg(googleAlbumURL)

Parameters:

  • Gphotos_url (str): URL of the Google Photos album.
  • scroll_pause_time (float, optional, default=0.5): Time to pause during scrolling for dynamic loading.
  • isHeadless (bool, optional, default=True): Whether to run the browser in headless mode.
  • imageXpath (str, optional, default='//a[@tabindex="0"]/@href'): XPath expression to locate image URLs.
  • url_prefix (str, optional, default="https://photos.google.com/"): Prefix for image URLs.
  • output_path (str, optional, default="defaultlocationpreference"): Path where compressed images will be saved.
  • window_height (str, optional, default="1080"): Browser window height in pixels.
  • window_width (str, optional, default="1920"): Browser window width in pixels.
  • scalefactor (str, optional, default="0.70"): Scaling factor for images in normal mode.
  • headless_scalefactor (str, optional, default="0.3"): Scaling factor for images in headless mode.
  • headless_height (str, optional, default="19900"): Browser height in pixels when in headless mode.
  • headless_width (str, optional, default="2400"): Browser width in pixels when in headless mode.

2. Advanced usecases.

Takes the Google Photos Album url as Input. Ensure that the Photos are set to "Accesible by anyone with the url".

Returns: A zip file of the compressed images (JPEGs).

from gPhotosAlbum_JPEGcompression import compress_GoogleAlbum_jpeg

Gphotos_url = "https://photos.google.com/share/exampleAlbumURL"

compress_GoogleAlbum_jpeg(
    Gphotos_url=Gphotos_url,
    scroll_pause_time=1.0,  # Increase scrolling pause to ensure all images are loaded
    isHeadless=True,  # Run in headless mode for faster execution
    imageXpath='//a[@tabindex="0"]/@href',  # XPath for locating image links
    url_prefix="https://photos.google.com/",  # URL prefix for constructing image links
    output_path="/compressed_images",  # Specify output path for compressed files
    window_height="1080",  # Window size for normal mode
    window_width="1920",
    scalefactor="0.8",  # Image scaling factor for compression
    headless_scalefactor="0.3",  # Scaling factor when running in headless mode
    headless_height="19900",  # Browser height for headless mode
    headless_width="2400"  # Browser width for headless mode
)

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

gphotosalbum_jpegcompression-2.2.1.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gphotosalbum_jpegcompression-2.2.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file gphotosalbum_jpegcompression-2.2.1.tar.gz.

File metadata

File hashes

Hashes for gphotosalbum_jpegcompression-2.2.1.tar.gz
Algorithm Hash digest
SHA256 e2faa88fa9bb33d558f7f759d50f8f298a1d9df0d42f17d2c285b3ec8763ca92
MD5 4adbf5fe519edf81d205eb34b0598dc4
BLAKE2b-256 c771a0e193a0300625c7f68728f1a27123f60d1c70a358140a31183d1c5a2eed

See more details on using hashes here.

File details

Details for the file gphotosalbum_jpegcompression-2.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gphotosalbum_jpegcompression-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4adf3ba7f2ecab3e80f8f2cab020b4dd5ec4c2b01d3fea3399649ef50fa82a12
MD5 8834df2a3d82ec28965ab79a3ae79ce7
BLAKE2b-256 0231e17b8a709afb4fe180e97972d3bd26948cd615d1dc397f2973e1c169b54b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page