Skip to content

Instantly share code, notes, and snippets.

@benjaminblack
Last active March 15, 2018 19:19

Revisions

  1. benjaminblack revised this gist Mar 15, 2018. No changes.
  2. benjaminblack revised this gist Mar 15, 2018. No changes.
  3. benjaminblack revised this gist Mar 12, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion imagemagick-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ Crop border around edges with fuzziness:
    convert image -fuzz 1% -trim +repage output
    ```

    Crop to portrait (9:16) at the center and scale down to specific height:
    Crop to portrait (9:16) at the center and scale down to specific height, at medium (30%) quality:

    ```bash
    for file in `ls *.jpg`; do convert "$file" -quality 30 -gravity center -crop 608x1080+0+0 -geometry x720 "portrait/$file"; done
  4. benjaminblack revised this gist Mar 12, 2018. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions imagemagick-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -20,3 +20,9 @@ Crop border around edges with fuzziness:
    ```bash
    convert image -fuzz 1% -trim +repage output
    ```

    Crop to portrait (9:16) at the center and scale down to specific height:

    ```bash
    for file in `ls *.jpg`; do convert "$file" -quality 30 -gravity center -crop 608x1080+0+0 -geometry x720 "portrait/$file"; done
    ```
  5. benjaminblack renamed this gist Mar 8, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. benjaminblack renamed this gist Mar 8, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions imagemagick scripts → imagemagick-scripts.md
    Original file line number Diff line number Diff line change
    @@ -11,12 +11,12 @@ done

    Crop transparent border around edges:

    ```
    ```bash
    convert image -trim +repage output
    ```

    Crop border around edges with fuzziness:

    ```
    ```bash
    convert image -fuzz 1% -trim +repage output
    ```
  7. benjaminblack revised this gist Mar 8, 2018. 2 changed files with 22 additions and 10 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,10 +0,0 @@
    Assuming the current directory contains a bunch of PNGs.

    ```bash
    for file in `ls *.png`
    do
    extension="${file##*.}"
    base="${file%.*}"
    convert "$file" -quality 60 "${base}.jpg"
    done
    ```
    22 changes: 22 additions & 0 deletions imagemagick scripts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    Convert a directory of PNGs to JPEGs:

    ```bash
    for file in `ls *.png`
    do
    extension="${file##*.}"
    base="${file%.*}"
    convert "$file" -quality 60 "${base}.jpg"
    done
    ```

    Crop transparent border around edges:

    ```
    convert image -trim +repage output
    ```

    Crop border around edges with fuzziness:

    ```
    convert image -fuzz 1% -trim +repage output
    ```
  8. benjaminblack revised this gist Mar 8, 2018. 1 changed file with 2 additions and 0 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    Assuming the current directory contains a bunch of PNGs.

    ```bash
    for file in `ls *.png`
    do
  9. benjaminblack created this gist Mar 8, 2018.
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    ```bash
    for file in `ls *.png`
    do
    extension="${file##*.}"
    base="${file%.*}"
    convert "$file" -quality 60 "${base}.jpg"
    done
    ```