Last active
June 20, 2024 08:56
-
-
Save xenolito/df26acd88e23e3b24c6f3a98ebaa1f75 to your computer and use it in GitHub Desktop.
Revisions
-
xenolito revised this gist
Jun 20, 2024 . 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 @@ -40,7 +40,7 @@ On the following example, will output files autonumber starting from 5 (05,06,07 `convert *.png -quality 100 document.pdf` ### Batch convert to webp to different output directory `mogrify -format webp -quality 80 -resize 1940 -path ./resized *.jpg` ### Convert png to ICO `convert apple-touch-favicon.png favicon.ico` -
xenolito revised this gist
Jun 7, 2023 . 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 @@ -41,3 +41,6 @@ On the following example, will output files autonumber starting from 5 (05,06,07 ### Batch convert to webp to different output directory `mogrify -format webp -quality 80 -resize 1940 -path ./resized *.JPG` ### Convert png to ICO `convert apple-touch-favicon.png favicon.ico` -
xenolito revised this gist
Apr 13, 2023 . 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 @@ -38,3 +38,6 @@ On the following example, will output files autonumber starting from 5 (05,06,07 ### Convert images to pdf `convert *.png -quality 100 document.pdf` ### Batch convert to webp to different output directory `mogrify -format webp -quality 80 -resize 1940 -path ./resized *.JPG` -
xenolito created this gist
Mar 13, 2023 .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,40 @@ ### 5) IMAGES: RESIZING WITH IMAGE MAGICK CLI: #### Resize and compress by 85% and autonumeral (%02d -> two digits) `magick *.jpg -resize 1440 -quality 85 ./resized/AH_000003-%02d.jpg` #### Rotate 90 degrees if height > width `convert input.jpg -rotate 90< output.jpg` #### Save the output file with the same filename as original (after rotating the image on this example) `-set filename:f` --> key we want to set `'%t'` --> value we assign to the previous key. %t is a shortcut to retrieve the filename. The long form is `%[basename]` `magick planos/*.jpg -rotate '-90<' -set filename:f '%t' planos/'%[filename:f].png'` #### Save the output file containing the directory name on its filename. The input file must contain the direcoty on its path, so you must be one level up... ``` $~/Desktop > magick AH_000007/*.jpg -resize 1440 -quality 85 -set filename:myname '%d' AH_000007/resized/'%[filename:myname]-%02d.jpg' ``` The output file names will be something like: `AH_000007-01.jpg` `AH_000007-02.jpg` `AH_000007-....jpg` #### Resize and output to a different folder with same file names `mogrify -resize 1440 -quality 85 -path ./resized *.jpg` #### Output filename autonumber starting from a specific value. Using the -scene [number] flag, where [number] is the number where the automatic count starts from. On the following example, will output files autonumber starting from 5 (05,06,07...) `magick AH_000032/*.jpg -resize 1440 -quality 85 -scene 5 -set filename:myname '%d' AH_000032/resized/'%[filename:myname]-%02d.jpg'` ### Convert images to pdf `convert *.png -quality 100 document.pdf`