Skip to content

Instantly share code, notes, and snippets.

@yig
Last active May 2, 2018 19:48
Show Gist options
  • Select an option

  • Save yig/9055ca0f34949532a4183dd284614e03 to your computer and use it in GitHub Desktop.

Select an option

Save yig/9055ca0f34949532a4183dd284614e03 to your computer and use it in GitHub Desktop.
Create PNG thumbnails for OBJ files on OS X using built-in QuickLook (and ImageMagick `mogrify` to trim them afterwards)
#!/bin/bash
'''
Author: Yotam Gingold <yotam (strudel) yotamgingold.com>
License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/)
Description: Create PNG thumbnails for OBJ files on OS X using built-in QuickLook (and ImageMagick `mogrify` to trim them afterwards).
'''
for obj_file in "$@"; do
## qlmanage comes with OS X
qlmanage -o "$(dirname "${obj_file}")" -t -s 1024 "${obj_file}"
## mogrify is part of ImageMagick: brew install imagemagick
mogrify -trim "${obj_file}".png
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment