diff --git a/README.org b/README.org index 5653c18..003133d 100644 --- a/README.org +++ b/README.org @@ -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']] diff --git a/tutorial/image_size_reduction.org b/tutorial/image_size_reduction.org new file mode 100644 index 0000000..c54f307 --- /dev/null +++ b/tutorial/image_size_reduction.org @@ -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 -quality 10% + +#+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]] +