Skip to content

Latest commit

 

History

History
237 lines (158 loc) · 5.21 KB

File metadata and controls

237 lines (158 loc) · 5.21 KB

Image

Open an image file from the command line

From DevOps-Bash-tools repo, determines whatever tool is available on either Linux or Mac and uses that to open the image file:

imageopen.sh "$filename"

This uses the default application for the file type.

Check & Change the default Application for a given file type

brew install duti

Check default Application for a given file type:

duti -x svg

Change this from say Inkscape which is a slow editor for just file viewing, to Google Chrome which is faster:

duti -s com.google.Chrome public.svg-image all

Convert Webp to PNG format

medium.com doesn't support using newer webp format images on the site so you need to convert them first:

On Mac, install the Imagemagick or Webp homebrew packages:

brew install imagemagick

or

brew install webp

Convert the image using ImageMagick:

magick "$name.webp" "$name.png"

or using dwebp:

dwebp "$name.webp" -o "$name.png"

or more simply use this script in DevOps-Bash-tools repo which will find / install and use one of the above tools, and protect against overwriting:

webp_to_png.sh "$name.webp"

You can also inspect the webp header like this:

webpinfo "$name.webp"

Convert SVG to PNG format

Many major websites like LinkedIn, Medium and Reddit do not accept SVG images so you must convert to another supported format like PNG.

Using ImageMagick:

convert "$name.svg" "$name.png"

or using Inkscape (slower than ImageMagick):

inkscape "$name.svg" --export-filename="$name.png"

or using rsvg-convert:

rsvg-convert "$name.svg" -o "$name.png"

or more simply use this script in DevOps-Bash-tools repo which will find / install and use one of the above tools and protect against overwriting:

svg_to_png.sh "$name.svg"

Trim Pixels off one side of an Image

Useful for tweaking Screenshots before sharing them.

You can use Imagemagick to do this from the command line more easily than using Gimp.

Use this script from DevOps-Bash-tools repo, as it's easier than using UI tools like Gimp or even ImageMagick directly etc.

image_trim_pixels.sh "$image" <top|bottom|left|right> "$num_pixels"

Join Two Images Together

Useful to create memes.

Since images can have different widths and end up with whitespace around the smaller image, use this script from the DevOps-Bash-tools repo to joins them after matching their heights or widths so they align correctly:

image_join_vertical.sh "$top_image" "$bottom_image" "joined_image.png"
image_join_horizontal.sh "$left_image" "$right_image" "joined_image.png"

Create Animated GIFs of Terminal Commands

:octocat: icholy/ttygif

:octocat: asciinema/asciinema

:octocat: faressoft/terminalizer

From DevOps-Bash-tools:

ttygif.sh
asciinema.sh
terminalizer.sh

Create custom Terminalizer config:

terminalizer init
The global config directory is created at
/Users/hari/.config/terminalizer

Then edit:

vim ~/.config/terminalizer/config.yml

Gif All the Things

Inspect Image File Metadata

exiftool "$file"

Identify command from imagemagick is more verbose:

identify -verbose "$file"

Exiv2 is less reliable:

exiv2 "$file"

Look for Watermarks

magick "$file" -edge 1 output.jpg

Then visually inspect the output.jpg which is blacked out to see sillouttes more easily.

You can also try converting to black & white (grey):

magick "$file" -channel Red -separate output.jpg

Steghide

This on only works if you've hidden something inside the image and know the password to extract it:

steghide info "$file"

Looks like this is removed from Mac Homebrew, launch it in a debian docker container instead:

steghide extract -sf "$file"

Image Upload Sites

See the File Upload & Code PasteBin sites doc.