-
-
Save yongqianme/be6fe14c612167c8dbda7124745bf2e7 to your computer and use it in GitHub Desktop.
Revisions
-
Kartones revised this gist
Feb 19, 2023 . 1 changed file with 1 addition and 101 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,101 +1 @@ Moved to [https://blog.kartones.net/page/image-and-video-cli-cheatsheet/](https://blog.kartones.net/page/image-and-video-cli-cheatsheet/) -
Kartones revised this gist
Nov 10, 2021 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -95,4 +95,7 @@ rename "s/\.jpeg$//" *.jpeg ### webm - To capture screencasts, I use [Kazam Screencaster](https://launchpad.net/kazam) (Linux) - To convert from `webm` to `gif`, I use [Online Converter](https://www.onlineconverter.com/convert/303aee2813c6043e6841c1c1e77e61bd56): Good compression quality and decent file size. ### favicons - [Optimizing favicons](https://gist.github.com/jaydenseric/a647f56e09e7ccbcb05867f4da1b6df2) + [ImageOptim online](https://imageoptim.com/online) -
Kartones revised this gist
Aug 11, 2021 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,6 +21,10 @@ rename 's/^/t_/' *.jpg * resize an image pixelating (without blending pixels): ```convert input.png -filter box -resize 400% output.png``` * generate a favicon from pngs (optimizes pretty well): ```convert 16.png 32.png 48.png favicon.ico``` ### webp * setup: ``` -
Kartones revised this gist
Aug 7, 2021 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,6 +57,24 @@ Animated GIF to MP4 video optimized for web: ffmpeg -i animation.gif -b:v 0 -crf 40 -vf scale=600:-1 video.mp4 ``` Cut a fragment from a video (without reencoding): ``` # 2.5 mins from starting time, without reencoding ffmpeg -ss 00:45:16 -i source.mp4 -t 150 -c:v copy -c:a copy test.mp4 ``` Reverse the frames from a video (Source: https://stackoverflow.com/questions/2553448/encode-video-in-reverse) ``` # Dump all video frames ffmpeg -i test.mp4 -an -qscale 1 %06d.jpg # Dump audio (TODO: remove/skip) ffmpeg -i test.mp4 -vn -ac 2 audio.wav # Cat video frames in reverse order to FFmpeg as input cat $(ls -r *jpg) | ffmpeg -f image2pipe -vcodec mjpeg -r 25 -i - -i audio.wav -vcodec libx264 -preset slow -crf 20 -threads 0 -acodec flac reversed.mkv ``` ### guetzli Needs [special binary](https://github.com/Kartones/guetzli) ``` -
Kartones revised this gist
Jul 24, 2021 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,4 +69,8 @@ If don't want to recurse directories: find . -type f -maxdepth 1 -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; rm *.jpg rename "s/\.jpeg$//" *.jpeg ``` ### webm - To capture screencasts, I use [Kazam Screencaster](https://launchpad.net/kazam) (Linux) - To convert from `webm` to `gif`, I use [Online Converter](https://www.onlineconverter.com/convert/303aee2813c6043e6841c1c1e77e61bd56): Good compression quality and decent file size. -
Kartones renamed this gist
Apr 19, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Kartones revised this gist
Feb 6, 2021 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,10 +38,6 @@ dwebp file.webp -o – | convert – file.jpg ``` for f in *.webp; do dwebp "$f" -o - | convert - "${f%.webp}.jpg"; done ``` - convert to webp lossy - JPG: ``` for f in *.jpg; do cwebp "$f" -q 90 -m 6 -o "${f%.jpg}.webp" -quiet; done @@ -50,6 +46,10 @@ for f in *.jpg; do cwebp "$f" -q 90 -m 6 -o "${f%.jpg}.webp" -quiet; done ``` for f in *.png; do cwebp "$f" -lossless -m 6 -q 100 -o "${f%.png}.webp" -quiet; done ``` - convert to webp lossy with alpha channel - GIF? (pending testing): ``` for f in *.gif; do cwebp "$f" -q 90 -alpha_q 100 -m 6 -o "${f%.gif}.webp" -quiet; done ``` ### ffmpeg Animated GIF to MP4 video optimized for web: -
Kartones revised this gist
Feb 6, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,15 +40,15 @@ for f in *.webp; do dwebp "$f" -o - | convert - "${f%.webp}.jpg"; done ``` * convert to webp lossy with alpha channel - GIF: ``` for f in *.gif; do cwebp "$f" -q 90 -alpha_q 100 -m 6 -o "${f%.gif}.webp" -quiet; done ``` - convert to webp lossy - JPG: ``` for f in *.jpg; do cwebp "$f" -q 90 -m 6 -o "${f%.jpg}.webp" -quiet; done ``` - convert to lossless webp - PNG: ``` for f in *.png; do cwebp "$f" -lossless -m 6 -q 100 -o "${f%.png}.webp" -quiet; done ``` ### ffmpeg -
Kartones revised this gist
Feb 6, 2021 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,18 @@ dwebp file.webp -o – | convert – file.jpg ``` for f in *.webp; do dwebp "$f" -o - | convert - "${f%.webp}.jpg"; done ``` * convert to webp lossy with alpha channel - GIF: ``` for f in *.gif; do cwebp "$f" -q 90 -alpha_q 100 -m 6 -o "${f%.gif}.webp"; done ``` - convert to webp lossy - JPG: ``` for f in *.jpg; do cwebp "$f" -q 90 -m 6 -o "${f%.jpg}.webp"; done ``` - convert to lossless webp - PNG: ``` for f in *.png; do cwebp "$f" -lossless -m 6 -q 100 -o "${f%.png}.webp"; done ``` ### ffmpeg Animated GIF to MP4 video optimized for web: -
Kartones revised this gist
Aug 10, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,7 @@ mogrify -format jpg -quality 90 -path thumbs -unsharp 0x.5 -thumbnail 100x100 -b cd thumbs rename 's/^/t_/' *.jpg ``` * [Examples of ImageMagick Usage](http://www.imagemagick.org/Usage/) (official) * [Fred's ImageMagick scripts](http://www.fmwconcepts.com/imagemagick/index.php) * resize an image pixelating (without blending pixels): -
Kartones revised this gist
Feb 29, 2020 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,9 @@ rename 's/^/t_/' *.jpg ``` * [Fred's ImageMagick scripts](http://www.fmwconcepts.com/imagemagick/index.php) * resize an image pixelating (without blending pixels): ```convert input.png -filter box -resize 400% output.png``` ### webp * setup: ``` -
Kartones revised this gist
May 4, 2019 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,10 +26,14 @@ sudo apt install webp ``` dwebp file.webp -o file.png ``` * convert one image to jpg (using ImageMagick): ``` dwebp file.webp -o – | convert – file.jpg ``` * convert all images from folder to jpg (using ImageMagick): ``` for f in *.webp; do dwebp "$f" -o - | convert - "${f%.webp}.jpg"; done ``` ### ffmpeg -
Kartones revised this gist
Mar 2, 2019 . 1 changed file with 21 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,27 @@ rename 's/^/t_/' *.jpg ``` * [Fred's ImageMagick scripts](http://www.fmwconcepts.com/imagemagick/index.php) ### webp * setup: ``` sudo apt install webp ``` * convert to png: ``` dwebp file.webp -o file.png ``` * convert to jpg (using ImageMagick): ``` dwebp file.webp -o – | convert – file.jpg ``` ### ffmpeg Animated GIF to MP4 video optimized for web: ``` ffmpeg -i animation.gif -b:v 0 -crf 40 -vf scale=600:-1 video.mp4 ``` ### guetzli Needs [special binary](https://github.com/Kartones/guetzli) ``` -
Kartones revised this gist
Mar 27, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,7 @@ mogrify -format jpg -quality 90 -path thumbs -unsharp 0x.5 -thumbnail 100x100 -b cd thumbs rename 's/^/t_/' *.jpg ``` * [Fred's ImageMagick scripts](http://www.fmwconcepts.com/imagemagick/index.php) ### guetzli Needs [special binary](https://github.com/Kartones/guetzli) -
kartones-tkt revised this gist
Apr 29, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ rename 's/^/t_/' *.jpg ``` ### guetzli Needs [special binary](https://github.com/Kartones/guetzli) ``` find . -type f -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; find . -type f -name "*.jpg" -exec rm {} + -
kartones-tkt revised this gist
Apr 29, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ Needs [special binary](https://github.com/google/guetzli/) ``` find . -type f -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; find . -type f -name "*.jpg" -exec rm {} + find . -type f -name "*.jpeg" | rename "s/\.jpeg$//" ``` If don't want to recurse directories: ``` -
kartones-tkt revised this gist
Apr 28, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,12 +20,12 @@ rename 's/^/t_/' *.jpg Needs [special binary](https://github.com/google/guetzli/) ``` find . -type f -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; find . -type f -name "*.jpg" -exec rm {} + find -type f -name "*.jpeg" | rename "s/\.jpeg$//" ``` If don't want to recurse directories: ``` find . -type f -maxdepth 1 -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; rm *.jpg rename "s/\.jpeg$//" *.jpeg ``` -
kartones-tkt revised this gist
Apr 28, 2017 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,11 +19,13 @@ rename 's/^/t_/' *.jpg ### guetzli Needs [special binary](https://github.com/google/guetzli/) ``` find . -type f -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; rm -rf *.jpg find -type f -name '*.jpeg' | rename 's/\.jpeg$//' ``` If don't want to recurse directories: ``` find . -type f -maxdepth 1 -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; rm *.jpg rename 's/\.jpeg$//' *.jpeg ``` -
kartones-tkt revised this gist
Apr 28, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,11 +19,11 @@ rename 's/^/t_/' *.jpg ### guetzli Needs [special binary](https://github.com/google/guetzli/) ``` find . -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; rm *.jpg rename 's/\.jpeg$//' *.jpeg ``` If don't want to recurse directories, alternative `find` call: ``` find . -maxdepth 1 -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \; ``` -
kartones-tkt revised this gist
Apr 28, 2017 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,4 +22,8 @@ Needs [special binary](https://github.com/google/guetzli/) find . -name "*.jpg" -exec guetzli --quality 90 {} {}.jpeg \; rm *.jpg rename 's/\.jpeg$//' *.jpeg ``` If don't want to recurse directories, alternative `find` call: ``` find . -maxdepth 1 -name "*.jpg" -exec guetzli --quality 90 {} {}.jpeg \; ``` -
kartones-tkt revised this gist
Apr 28, 2017 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ### imagemagick * Nornalize all images of a folder converting them to jpgs with 90% quality (warning, removes original files): ``` rename 's/\.JPG$/\.jpg/' *.JPG @@ -13,4 +14,12 @@ mkdir thumbs mogrify -format jpg -quality 90 -path thumbs -unsharp 0x.5 -thumbnail 100x100 -background black -gravity center -extent 100x100 *.jpg cd thumbs rename 's/^/t_/' *.jpg ``` ### guetzli Needs [special binary](https://github.com/google/guetzli/) ``` find . -name "*.jpg" -exec guetzli --quality 90 {} {}.jpeg \; rm *.jpg rename 's/\.jpeg$//' *.jpeg ``` -
Kartones revised this gist
Feb 14, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,8 @@ * Nornalize all images of a folder converting them to jpgs with 90% quality (warning, removes original files): ``` rename 's/\.JPG$/\.jpg/' *.JPG rename 's/\.JPEG$/\.jpg/' *.JPEG rename 's/\.jpeg$/\.jpg/' *.jpeg mogrify -format jpg *.png mogrify -resize 1600x1280\> -quality 90 *.jpg rm *.png -
Kartones revised this gist
Sep 16, 2016 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,4 +5,11 @@ rename 's/\.JPEG$/\.jpg/' *.JPEG mogrify -format jpg *.png mogrify -resize 1600x1280\> -quality 90 *.jpg rm *.png ``` * Generate 100x100 JPG thumbnails at a `/thumbs' subfolder from all JPG images of current folder, padding with black: ``` mkdir thumbs mogrify -format jpg -quality 90 -path thumbs -unsharp 0x.5 -thumbnail 100x100 -background black -gravity center -extent 100x100 *.jpg cd thumbs rename 's/^/t_/' *.jpg ``` -
Kartones revised this gist
Mar 29, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ``` rename 's/\.JPG$/\.jpg/' *.JPG rename 's/\.JPEG$/\.jpg/' *.JPEG mogrify -format jpg *.png mogrify -resize 1600x1280\> -quality 90 *.jpg rm *.png ``` -
Kartones created this gist
Mar 28, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ * Nornalize all images of a folder converting them to jpgs with 90% quality (warning, removes original files) ``` rename 's/\.JPG$/\.jpg/' *.JPG rename 's/\.JPEG$/\.jpg/' *.JPEG mogrify -resize 1600x1280\> -quality 90 *.jpg mogrify -format jpg *.png rm *.png ```