Add imagemagick tutorial

This commit is contained in:
Jose 2023-08-20 22:17:42 -03:00
parent c4325d5a9e
commit fee6466a40
2 changed files with 74 additions and 1 deletions

View File

@ -42,7 +42,10 @@ opportunity to learn about computers, files, directories and programs.
* [[./tutorial/pacman.org][Use package manager in Parabola GNU-linux: verify packages in cache]]
* [[./tutorial/removing_packages.org][Removing packages in Parabola GNU-Linux]]
** Work with images
* [[./tutorial/image_size_reduction.org][Reduce image quality and size from terminal]]
** Disk space utilization and manipulation
* [[./tutorial/ncdu.org][Exploring disk space with 'ncdu']]

View File

@ -0,0 +1,70 @@
#+date: 2023-08-20
#+options: toc:nil num:nil author:nil
* Use imagemagick to manipulate images
Converting multiple ~jpg~ files into lower size images:
#+begin_example sh
convert '*.jpg' -set filename:fn '%[basename]-small' -resize 960x640 '%[filename:fn].jpg'
#+end_example
convert <INPUT_FILE> -quality 10% <OUTPUT_FILE>
#+begin_example sh
convert '*.jpg' -set filename:fn '%[basename]-small' -quality 50% '%[filename:fn].jpg'
#+end_example
** Using mogrify
Counting number of ~.jpg~ images in a directory:
#+begin_example sh
ls -1U DIR_NAME | wc -l
#+end_example
Output:
75
Verifying the images weight:
#+begin_example sh
du -h
#+end_example
Output:
306 M
Resize all the ~.jpg~ images within the directory:
#+begin_example sh
mogrify -resize 960x640 *.jpg
#+end_example
Output:
42M
#+begin_example sh
mogrify -quality 80% *.jpg
#+end_example
Weight:
#+begin_example sh
du -h
#+end_example
Output:
12M
** References
- [[https://askubuntu.com/questions/1354205/imagemagick-convert-on-a-multiple-files][Imagemagick to convert multiple files]]
- [[https://imagemagick.org/][Imagemagick web site]]
- [[https://www.digitalocean.com/community/tutorials/reduce-file-size-of-images-linux][Digital ocean tutorial]]