Skip to content

Instantly share code, notes, and snippets.

@TurnerSoftwareDev
TurnerSoftwareDev / rotate-img
Created October 16, 2023 02:43
Rotate an image either from a local file or a URL
#!/usr/bin/env bash
# Rotates an image from either a local file or from a URL passed on the command line or to stdin,
# and prints the rotated image file path to stdout.
#
# Positive angles rotate clockwise, negative counterclockwise.
# Exit on first error
set -e
@TurnerSoftwareDev
TurnerSoftwareDev / flip-img
Created October 16, 2023 02:41
Horizontally flip an image from a local file or a URL
#!/usr/bin/env bash
# Flips an image horizontally from either a local file or from a URL passed on the command line or to stdin,
# and prints flipped image file path to stdout.
#
# Options:
#
# -h,--help Display help
# -z,--horizontal Flip the image horizontally (default)
# -i,--input The image to flip
@TurnerSoftwareDev
TurnerSoftwareDev / resize-img
Created October 16, 2023 02:40
Resize an image from a local file or URL
#!/usr/bin/env bash
# Resizes an image from either a local file or a URL passed on the command line or to stdin,
# and prints the resized image file path to stdout.
#
# Options:
#
# resize-img -h
#
# Examples:
@TurnerSoftwareDev
TurnerSoftwareDev / imgur
Created October 16, 2023 01:18
Upload images to Imgur from a file or URL
#!/usr/bin/env bash
# Uploads an image to imgur.com from either a local file or from a URL passed on the command line or to stdin,
# and prints the imgur.com URL to stdout.
#
# Examples:
#
# imgur foo.png
# imgur http://example.com/foo.jpg
# echo foo.png | imgur
@TurnerSoftwareDev
TurnerSoftwareDev / scramble
Created October 16, 2023 01:11
Symmetrically encrypt or decrypt a file with GnuPG using a password
#!/usr/bin/env bash
#
# Shell script that encrypts or decrypts a file with a password using GnuPG.
# The encrypted file is named with a .scramble extension.
# Input file is deleted unless the --keep flag is specified.
#
# Usage:
#
# scramble [--keep] <file>
@TurnerSoftwareDev
TurnerSoftwareDev / extract-pdf-images
Last active October 21, 2023 13:40 — forked from bendavis78/extract_pdf_images.sh
Extracts images from PDF while preserving PNG transparency
#!/usr/bin/env bash
# Extracts images from a PDF into a directory, preserving transparency.
#
# Inspired by https://gist.github.com/bendavis78/ed22a974c2b4534305eabb2522956359
#
# Options:
#
# --help, -h Display help
# --pdf, -p The PDF to extract images from