instaSquared

I showed instaCropper to my social media clients, and they were impressed. One of them suggested that I increase the size of the canvas, rather than crop the images to squares. The tradeoff is that increasing the canvas makes the original image relatively smaller. The advantage is that I can bulk process photos in about a third of the time it took me to process them with instaCropper.

InstaSquared starts by ensuring the file in question is a photo by checking for EXIF data; if there is no EXIF the user is informed that the file is being skipped. Once it’s established that the file is a photo, it finds the longer side and uses that dimension to make a new canvas. There is some math to figure out offsets and the original photo is pasted onto the center of the new canvas.

instaSquared was designed to process bulk images that are sent to me by show photographers. With that in mind I eliminated all of the user decisions that were available in instaCropper. Now all files have “squared_” prefixed onto the original file name and the new file is saved to a “squared” directory in the parent directory.

If you try it out, please let me know what you think.

Original photo from my trip to Oahu
InstaSquared version of the above (resized by WordPress)
instaSquared

instaCropper

I started managing social media for a local theatre group. We’re trying to improve engagement on FaceBook (in our group and in each event), Twitter and Instagram. The process was eating in to the time I allotted for this project, so in addition to setting up an account at Sendible to automate post scheduling, I created the instaCropper tool.

The problem with Insta’ (the ‘Gram) is that the images for upload must be perfectly square (except for story photos which can be something like 1.9:1). The next issue is that performers universally don’t ask their photographers to provide the equivalent of passport photos just so some social media dude can make Instagram posts. Certainly cropping a single photo perfectly square isn’t particularly time consuming…

But I write code! Why would I do this manually? Ten performers plus two producers times three photos for each of those, plus photos of three back-of-house people, plus show prep photos equals more time that I want to spend drawing perfect squares.

Starting with the Pillow library, I was able to write a script that will take in a single image or a directory for processing multiple images. Each image is opened in preview to confirm that image is correct. If the orientation is wrong I can rotate or flip the image as needed. Should there be more background than I want I can set the crop origin. The crop is confirmed via a preview image. Once it’s what I want I can save it with a custom filename and in a separate directory from the original photo – all from the command line.

Processing a single image used to take at least 70 seconds. It now takes about 11 seconds and there is no chance that I will accidentally overwrite the original photo (that happened more than once, fortunately I was working on local copies from a google drive folder). If you use the tool, please let me know. If you think of reasonable additions, feel free to create a github issue.

instaCropper