Skip to main content

picToSquare (Pic To Square) is an experimental python script that 'squares up' every picture in a directory to be Instagram ready.

Project description

PicToSquare

https://img.shields.io/pypi/v/pictosquare.svg https://img.shields.io/travis/hithismani/pictosquare.svg Documentation Status

picToSquare is an experimental script that makes use of Pillow to enter and make every picture in a directory “Instagram Ready” by framing ‘em up into a little square.

This script was inspired by how there are multiple free/paid apps to accomplish this on the mobile app store, but none for desktop. Hope this made your social media routine a little less annoying!

Tested On Windows 10 + Python 3.6 + PILLOW 6.0

Terminal Sample: ![console-script](https://i.imgur.com/An933hI.png)

Output Sample: ![output-sample](https://i.imgur.com/SS5Vnp3.png)

  • Free software: MIT license

Advantages:

  • Does not compress or crop images.

  • Relatively quick.

  • Does not rename images.

  • Optionally set a background colour to either “white” or “black”. (Defaults to white if not set)

  • All pictures are resized into a “picToSquare” directory

How It Works:

  1. git pull this repository

  2. cd pictosquare

  3. <code>pip install requirements.txt</code>

  4. run <code>python src/index.py -dir <i>(Your Image Directory Path)</i></code>

  5. visit “picToSquare” folder within the directory specified for your images 🖼.

Running Examples:

  1. Basic Script Usage:

    <code>python src/index.py -dir C://UserName/FolderToBeResized</code>

  2. Custom Colours:

    <code>python src/index.py -dir C://UserName/FolderToBeResized -color black</code>

Points To Remember:

  • This script requires a folder and does not work on single files. (If you require this to work on a single file, just place it in a folder. Easy!)

  • The script will ignore all files that are not .jpeg, or .jpg. With .png files it would attempt to do an Image.alpha_compose before squaring up the image.

  • This script tends to break on RGBA (Transparent) images. Some transparent images get ‘squared’ into an image with a transparent background instead of the colour specified. It’s recommended that you convert the .png image to a .jpeg to fix this.

  • Every image in your “picToSquare” folder will be overwritten if the filenames match. The script would not clean the Resized folder before each run. (But you can add that functionality yourself, if need be)

  • The script depends on Args (for the command line prompts) and PIL/Pillow.

Experimental:

  • Watermark each image.
    • Save a .png image with the name “watermark.png” in the same directory you want the script to look up. The script would automatically watermark each picture with the watermarked image.

    • Optionally set the image size of the watermark by setting its percentage at the end of the filename. Example “watermark**20**.png” implying watermark that’s sized 20% of the image.

    • End the filename with an optional placement.

      Positions Include: - “-bl” - bottom left (default) - “-br” - bottom right - “-tl” - top left - “-tr” - top right

      Usage: “watermark -bl.png” (without spaces!)

  • Set a custom background color for specific images. - Add a “#hexcode” at the end of the filename from your folder and watch the script add that to the specific image. Usage: “imagename #eeeeeeee.png” (without spaces!)

  • Set a custom background that is neither “black” not “white” for all images. - Add “-color hex-code” to the end of your request. - Example: <code>python src/index.py -dir C://UserName/FolderToBeResized -color *cccccc* </code>

  • Pick Dominant Colour For Every Image: (Powered by [ColorThief](https://github.com/fengsp/color-thief-py))

    Set colour to “thief”.

    Run: <code>python src/index.py -dir C://UserName/FolderToBeResized -color thief</code>

Future Plans

  • Probably turn this into an installable package.

  • Add a friendly GUI to perform the same actions.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Changelog

  • 28/05/2019
    • Added colorThief Support.

    • Code hygiene changes.

  • 18/05/2019
    • Added progressbar + tqdm dependency.

    • Fixed FolderFetcher.py to reflect the above stated dependency.

    • Fixed ReadMe file typos.

History

0.1.0 (2019-10-30)

  • First release on PyPI.

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

pictosquare-0.1.0.tar.gz (19.3 kB view details)

Uploaded Source

File details

Details for the file pictosquare-0.1.0.tar.gz.

File metadata

  • Download URL: pictosquare-0.1.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0

File hashes

Hashes for pictosquare-0.1.0.tar.gz
Algorithm Hash digest
SHA256 525c9acc389654742b11d284f8e6846a9c55706ba60fd06c5928ee87e1bc3c29
MD5 2bf036d9d640d0bcc4479e34ee6b0fb8
BLAKE2b-256 6dec9b823f0ebd67a02ab69e0b9b1c97e94b2022714e21ec6e9c1fe9afb9a4b3

See more details on using hashes here.

Supported by

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