Last active
          April 15, 2025 00:03 
        
      - 
      
 - 
        
Save sulram/0c8a95fc90f23e860b9a to your computer and use it in GitHub Desktop.  
Revisions
- 
        
sulram revised this gist
Jul 4, 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 @@ -14,6 +14,7 @@ Remember that the order of parameters/options is very important. ##### resize and crop convert *.jpg -resize "460x460^" -gravity center -crop 460x460+0+0 +repage crop.jpg mogrify -path ../voxels3 -format png -resize "512x512^" -gravity center -crop 512x512+0+0 +repage *.png ##### resize to fit with background  - 
        
sulram revised this gist
Jul 4, 2020 . 1 changed file with 9 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 @@ -65,4 +65,12 @@ thanks to <http://blog.room208.org/post/48793543478> ##### prores ffmpeg -i aya-mpeg4.mov -c:v prores -profile:v 2 aya-prores.mov ffmpeg -i aya-mpeg4.mov -vcodec prores_ks -pix_fmt yuva444p10le -alpha_bits 16 -profile:v 4444 -f mov aya-prores-alpha.mov ##### stretch video ffmpeg -i input.mp4 -filter_complex "setpts=PTS/10" output.mp4 ##### video from png ffmpeg -r 8 -i stylegan-%06d.png -c:v libx264 -vf fps=30 -pix_fmt yuv420p latent-space-walker.mp4  - 
        
sulram revised this gist
Dec 19, 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 @@ -62,3 +62,7 @@ thanks to <http://blog.room208.org/post/48793543478> convert ani.gif -coalesce ani.png ffmpeg -f image2 -i ani-%d.png ani.mpg -vb 20M ##### prores ffmpeg -i aya-mpeg4.mov -c:v prores -profile:v 2 aya-prores.mov ffmpeg -i aya-mpeg4.mov -vcodec prores_ks -pix_fmt yuva444p10le -alpha_bits 16 -profile:v 4444 -f mov aya-prores-alpha.mov  - 
        
sulram revised this gist
Dec 11, 2014 . 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 @@ Remember that the order of parameters/options is very important. ##### convert images and save to another dir convert *.png -set filename:original %t 'export/%[filename:original].jpg'  - 
        
sulram revised this gist
Dec 11, 2014 . 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,6 +1,7 @@ ### How-to: Convert JPG to PDF using ImageMagick <http://catlingmindswipe.blogspot.com.br/2013/11/how-to-convert-jpg-to-pdf-using.html> It's a common enough task, trying to convert multiple jpg files into one pdf, particularly when I don't need these to be converted with such high quality, I just want the black and white text readable. I can scan, crop, and monochrome in a graphics program but compiling them into a single PDF booklet was always tricky. Which is how I started using ImageMagick.  - 
        
sulram renamed this gist
Dec 11, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. - 
        
sulram revised this gist
Dec 11, 2014 . 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 @@ -2,6 +2,10 @@ Remember that the order of parameters/options is very important. ##### convert to another dir convert *.png -set filename:original %t 'export/%[filename:original].jpg' ##### resize, change dpi and quality convert *.jpg -resize 1600 -quality 70% -depth 72 -units pixelsperinch resized.jpg  - 
        
sulram revised this gist
Dec 10, 2014 . 1 changed file with 44 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 @@ -0,0 +1,44 @@ <http://catlingmindswipe.blogspot.com.br/2013/11/how-to-convert-jpg-to-pdf-using.html> How-to: Convert JPG to PDF using ImageMagick It's a common enough task, trying to convert multiple jpg files into one pdf, particularly when I don't need these to be converted with such high quality, I just want the black and white text readable. I can scan, crop, and monochrome in a graphics program but compiling them into a single PDF booklet was always tricky. Which is how I started using ImageMagick. ImageMagick is a command line conversion program that is capable of so many more batch operations than this - resizing, compression, format conversion - and it's available on all platforms - Linux, Windows and Mac. Bear in mind that creating a PDF document from multiple JPEG images can take some time and you may want to trial different settings for size and quality of output, so I suggest you make a copy of the JPEG files in a temporary folder to play around with and use Imagemagick on those, NOT your originals. Reducing the resolution as a first step will also make things much quicker. Originally I was just using the basic convert *.jpg output.pdf and/or convert *.jpg -adjoin output.pdf which works most of the time, however there's a bug in the convert routine which can in some versions give a segmentation fault when converting a number of JPEG files to one PDF file. What this command does is take all the .jpg's (or format of your choice) in a folder and convert them to a single PDF - you can name it whatever you like. You can avoid the segmentation fault bug and do the compression at the same time if you use convert *.JPG -compress Zip output.pdf but the zip compression appears quite inefficient and results in huge file sizes. You could resize and lower the quality of the images using; mogrify -resize 50% -quality 25 Which overwrites the originals. You can combine resizing and conversion using convert -quality 25 -resize 50% *.jpg -adjoin output.pdf which works, but takes longer as you're combining batch operations. And yes, you can resizing images without overwriting the originals by specifying a new file name; convert '*.JPG' -resize 640x480 newfile%03d.jpg which outputs the converted images as newfile001.jpg, newfile002.jpg, and so on. Alternatively, if you want to retain the original file name and prepend new, you could use a bit more code: for file in *.JPG ; do convert "$file" -resize 640x480 "new-${file}" ; done This is just a sample of what Imagemagick can do if you are prepared to experiment at the command line. RC  - 
        
sulram revised this gist
Dec 10, 2014 . 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 @@ -1,4 +1,4 @@ ### ImageMagick and FFMPEG commands Remember that the order of parameters/options is very important.  - 
        
sulram revised this gist
Dec 10, 2014 . 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 @@ -11,7 +11,7 @@ Remember that the order of parameters/options is very important. convert *.jpg -resize "460x460^" -gravity center -crop 460x460+0+0 +repage crop.jpg ##### resize to fit with background convert *.png -background black -resize 1024x768 -gravity center -extent 1024x768 fit.png  - 
        
sulram revised this gist
Dec 10, 2014 . 1 changed file with 6 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,5 +1,7 @@ ### ImageMagick commands Remember that the order of parameters/options is very important. ##### resize, change dpi and quality convert *.jpg -resize 1600 -quality 70% -depth 72 -units pixelsperinch resized.jpg @@ -9,6 +11,10 @@ convert *.jpg -resize "460x460^" -gravity center -crop 460x460+0+0 +repage crop.jpg #### resize to fit with background convert *.png -background black -resize 1024x768 -gravity center -extent 1024x768 fit.png ##### mosaic with cropped images montage crop*.jpg -geometry 460x460+0+0 mosaic.jpg  - 
        
sulram revised this gist
Dec 2, 2014 . 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 @@ -3,6 +3,7 @@ ##### resize, change dpi and quality convert *.jpg -resize 1600 -quality 70% -depth 72 -units pixelsperinch resized.jpg convert *.jpg -set filename:original %t -resize 1600 -quality 70% -depth 72 -units pixelsperinch 'resized_%[filename:original].jpg' ##### resize and crop  - 
        
sulram revised this gist
Nov 27, 2014 . 2 changed files with 25 additions and 26 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,27 @@ ### ImageMagick commands ##### resize, change dpi and quality convert *.jpg -resize 1600 -quality 70% -depth 72 -units pixelsperinch resized.jpg ##### resize and crop convert *.jpg -resize "460x460^" -gravity center -crop 460x460+0+0 +repage crop.jpg ##### mosaic with cropped images montage crop*.jpg -geometry 460x460+0+0 mosaic.jpg ##### scale and stack images convert *.png -append -scale 50% stacked.png ##### animated gif from png files convert -delay 5 -loop 0 *.png ../animation.gif ##### from mov to gif (with ffmpeg) thanks to <http://blog.room208.org/post/48793543478> @@ -26,4 +50,4 @@ thanks to <http://blog.room208.org/post/48793543478> convert ani.gif -coalesce ani.png ffmpeg -f image2 -i ani-%d.png ani.mpg -vb 20M 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,25 +0,0 @@  - 
        
sulram revised this gist
Nov 27, 2014 . 2 changed files with 25 additions and 25 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,28 +1,3 @@ ##### from mov to gif (with ffmpeg) thanks to <http://blog.room208.org/post/48793543478> 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,25 @@ ### ImageMagick + FFMPEG commands ##### resize, change dpi and quality convert *.jpg -resize 1600 -quality 70% -depth 72 -units pixelsperinch resized.jpg ##### resize and crop convert *.jpg -resize "460x460^" -gravity center -crop 460x460+0+0 +repage crop.jpg ##### mosaic with cropped images montage crop*.jpg -geometry 460x460+0+0 mosaic.jpg ##### scale and stack images convert *.png -append -scale 50% stacked.png ##### animated gif from png files convert -delay 5 -loop 0 *.png ../animation.gif  - 
        
sulram revised this gist
Nov 27, 2014 . 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 @@ -0,0 +1,4 @@ for img in *.png; do filename=${img%.*} convert "$filename.png" "$filename.jpg" done  - 
        
sulram revised this gist
Nov 27, 2014 . 1 changed file with 10 additions and 10 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,33 +1,33 @@ ### ImageMagick + FFMPEG commands ##### resize, change dpi and quality convert *.jpg -resize 1600 -quality 70% -depth 72 -units pixelsperinch resized.jpg ##### resize and crop convert *.jpg -resize "460x460^" -gravity center -crop 460x460+0+0 +repage crop.jpg ##### mosaic with cropped images montage crop*.jpg -geometry 460x460+0+0 mosaic.jpg ##### scale and stack images convert *.png -append -scale 50% stacked.png ##### animated gif from png files convert -delay 5 -loop 0 *.png ../animation.gif ##### from mov to gif (with ffmpeg) thanks to <http://blog.room208.org/post/48793543478> ###### 1. convert video to PNG sequence with FFMPEG ffmpeg -i video.mov -r 10 -s 640x400 -f image2 frames/frame-%03d.png @@ -37,7 +37,7 @@ thanks to <http://blog.room208.org/post/48793543478> * `-f image2` the output format, a series of still images * `frames/frame-%03d.png` is a printf format string specifying the output filenames, in this case `dir/name-###.png`, a series of PNG images called 001.png, 002.png, 003.png, and so on. ###### 2. convert PNG sequence to animated GIF convert frames/*.png -delay 1x8 -coalesce -layers OptimizeTransparency animation.gif @@ -47,7 +47,7 @@ thanks to <http://blog.room208.org/post/48793543478> * `-layers OptimizeTransparency` tells ImageMagick to replace portions of each frame that are identical to the corresponding parts of the preceding frame with transparency, saving on file size. * `animation.gif` output file ##### convert gif to images and video convert ani.gif -coalesce ani.png ffmpeg -f image2 -i ani-%d.png ani.mpg -vb 20M  - 
        
sulram revised this gist
Nov 27, 2014 . 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 @@ -1,5 +1,9 @@ # ImageMagick + FFMPEG commands ### resize, change dpi and quality convert *.jpg -resize 1600 -quality 70% -depth 72 -units pixelsperinch resized.jpg ### resize and crop convert *.jpg -resize "460x460^" -gravity center -crop 460x460+0+0 +repage crop.jpg  - 
        
sulram revised this gist
Nov 20, 2014 . 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,5 +1,14 @@ # ImageMagick + FFMPEG commands ### resize and crop convert *.jpg -resize "460x460^" -gravity center -crop 460x460+0+0 +repage crop.jpg ### mosaic with cropped images montage crop*.jpg -geometry 460x460+0+0 mosaic.jpg ### scale and stack images convert *.png -append -scale 50% stacked.png  - 
        
sulram revised this gist
Aug 5, 2014 . 1 changed file with 7 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 @@ -32,4 +32,10 @@ thanks to <http://blog.room208.org/post/48793543478> * `-delay 1x8` says that the animation should play a frame every 1/8 of a second. I computed this number by looking at the frame rate of the original video (24) and dividing by the number of frames each drawing plays for (3). Note that most browsers slow down animations that play faster than 20 frames per second, or 1/50 second per frame. Most videos play back at between 25 and 30 fps, so you may have to drop every other frame or so if you care about accuracy of playback speed. * `-coalesce` apparently “fully define[s] the look of each frame of an [sic] GIF animation sequence, to form a ‘film strip’ animation,” according to the documentation. * `-layers OptimizeTransparency` tells ImageMagick to replace portions of each frame that are identical to the corresponding parts of the preceding frame with transparency, saving on file size. * `animation.gif` output file ### convert gif to images and video convert ani.gif -coalesce ani.png ffmpeg -f image2 -i ani-%d.png ani.mpg -vb 20M 
 - 
        
sulram revised this gist
May 25, 2014 . 1 changed file with 2 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,5 @@ # ImageMagick + FFMPEG commands ### scale and stack images convert *.png -append -scale 50% stacked.png  - 
        
sulram revised this gist
May 25, 2014 . 1 changed file with 11 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 @@ -11,7 +11,9 @@ ### from mov to gif (with ffmpeg) thanks to <http://blog.room208.org/post/48793543478> #### 1. convert video to PNG sequence with FFMPEG ffmpeg -i video.mov -r 10 -s 640x400 -f image2 frames/frame-%03d.png * `-i video.mov` the video file @@ -20,4 +22,12 @@ thanks to <http://blog.room208.org/post/48793543478> * `-f image2` the output format, a series of still images * `frames/frame-%03d.png` is a printf format string specifying the output filenames, in this case `dir/name-###.png`, a series of PNG images called 001.png, 002.png, 003.png, and so on. #### 2. convert PNG sequence to animated GIF convert frames/*.png -delay 1x8 -coalesce -layers OptimizeTransparency animation.gif * `frames/*.png` input files * `-delay 1x8` says that the animation should play a frame every 1/8 of a second. I computed this number by looking at the frame rate of the original video (24) and dividing by the number of frames each drawing plays for (3). Note that most browsers slow down animations that play faster than 20 frames per second, or 1/50 second per frame. Most videos play back at between 25 and 30 fps, so you may have to drop every other frame or so if you care about accuracy of playback speed. * `-coalesce` apparently “fully define[s] the look of each frame of an [sic] GIF animation sequence, to form a ‘film strip’ animation,” according to the documentation. * `-layers OptimizeTransparency` tells ImageMagick to replace portions of each frame that are identical to the corresponding parts of the preceding frame with transparency, saving on file size. * `animation.gif` output file  - 
        
sulram revised this gist
May 25, 2014 . 1 changed file with 9 additions and 11 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 @@ -9,17 +9,15 @@ ### from mov to gif (with ffmpeg) thanks to <http://blog.room208.org/post/48793543478> ffmpeg -i video.mov -r 10 -s 640x400 -f image2 frames/frame-%03d.png * `-i video.mov` the video file * `-r 10` the rate * `-s 640x400` the output size * `-f image2` the output format, a series of still images * `frames/frame-%03d.png` is a printf format string specifying the output filenames, in this case `dir/name-###.png`, a series of PNG images called 001.png, 002.png, 003.png, and so on.  - 
        
sulram revised this gist
May 25, 2014 . 2 changed files with 25 additions and 10 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 @@ -0,0 +1,25 @@ ### scale and stack images convert *.png -append -scale 50% stacked.png ### animated gif from png files convert -delay 5 -loop 0 *.png ../animation.gif ### from mov to gif (with ffmpeg) The order of command line arguments matters. This command line should work but will generate a giant file: ffmpeg -i yesbuddy.mov -pix_fmt rgb24 output.gif Note that you probably want to reduce the frame rate and size when you convert, as well as specify a start time and duration. You probably do not want to convert the entire file at its original resolution and frame rate. ffmpeg -ss 00:00:00.000 -i yesbuddy.mov -pix_fmt rgb24 -r 10 -s 320x240 -t 00:00:10.000 output.gif The file size will still be huge. You may be able to use ImageMagick's GIF optimizer to reduce the size: convert -layers Optimize output.gif output_optimized.gif 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,10 +0,0 @@  - 
        
sulram created this gist
May 24, 2014 .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,10 @@ # ImageMagick commands ### animated gif from png files convert -delay 5 -loop 0 *.png ../animation.gif ### scale and stack images convert *.png -append -scale 50% stacked.png