Skip to content

Instantly share code, notes, and snippets.

@gcpantazis
Last active December 20, 2015 18:49
Show Gist options
  • Select an option

  • Save gcpantazis/6178424 to your computer and use it in GitHub Desktop.

Select an option

Save gcpantazis/6178424 to your computer and use it in GitHub Desktop.
Use ImageMagick's `identify` command to create a CLI command for evaluating images and getting a same-sized placeholder.
#!/bin/bash
echo "http://placehold.it/$(identify $1 | sed -n 's/.* \([0-9][0-9]*x[0-9][0-9]*\) .*/\1/p')"
@gcpantazis

Copy link
Copy Markdown
Author

Usage:

getPlaceholder path/to/some/image.jpg

Output:

http://placehold.it/2800x1240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment