These scripts write the time and date from the EXIF date of an image, as text onto that image, and scales the image into a smaller one. And this for a all the images in a dir.
This is done via one of these scripts:
- timestamp_files.sh, to add a timestamp from the EXIF data to all the image in the input dir and write output to the output dir.
- timestamp_file.sh, does the same as 'timestamp_files.sh', but only for 1 file and needs to be called with cli variables.
- timesstamp_parallel.sh, does the same as 'timestamp_files.sh', but only in parallel in stead of sequential. Makes use of 'timestamp_file.sh'.
- timestamp-rescale.sh, to scale all the images in the input dir into a smaller images in the output dir..
- combine-tiemstamp-rescale.sh, runs first the timestamp and then the rescale.
These scripts is using:
- 'convert' and 'identify', which is part of 'imagemagick'.
- the font Roboto, which you can replace in the script by another.
- Part of every GNU ecosystem:
- 'bash' (for running script).
- 'date' function/application.
- 'echo' (for overal usage).
- 'tr', 'cut' (for date format).
- 'grep', 'ls', 'wc' (for progressbar).
- [V] count input files
- [V] count timestamped files
- [V] count scaled files
- [V] start, stop, duration time feedback
- [-] optimize scale script to use parallelization
- [-] run renamejpg from the combine script on the input file directory
- [-] if scaled/timestamped dir are with files, by default rename dir (overwrite with cli flag)
You need to install imagemagick.
sudo apt install imagemagick
sudo apt install parallel
convert logo: logo.gif
convert -version
identify -version
fc-list | grep -i arial
convert -list font|grep Liberation-Sans
- https://legacy.imagemagick.org/Usage/annotating
- https://legacy.imagemagick.org/Usage/draw/#annotate
- https://legacy.imagemagick.org/script/command-line-options.php?#annotate
- https://github.com/ImageMagick/ImageMagick
- https://techpiezo.com/linuxinstall-imagemagick-in-ubuntu-20-04-lts
- https://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-5.html
- https://tldp.org/LDP/abs/html/varassignment.html
- https://www.cyberciti.biz/faq/bash-loop-over-file
- https://linuxize.com/post/bash-concatenate-strings
- https://en.wikibooks.org/wiki/Cut
- https://www.geeksforgeeks.org/date-command-linux-examples
- https://www.cyberciti.biz/faq/check-if-a-directory-exists-in-linux-or-unix-shell
- https://www.cyberciti.biz/faq/howto-check-if-a-directory-exists-in-a-bash-shellscript
- https://stackoverflow.com/questions/238073/how-to-add-a-progress-bar-to-a-shell-script
- https://stackoverflow.com/questions/12498304/using-bash-to-display-a-progress-indicator
- https://stackoverflow.com/questions/38339434/making-simple-shell-progress-bar
- https://stackoverflow.com/questions/23630501/how-to-progress-bar-in-bash
- https://stackoverflow.com/questions/29058741/need-to-cropresize-300000-files-runtime-4-days-how-can-i-speed-up-my-bash
- https://www.gnu.org/software/bash/manual/html_node/GNU-Parallel.html
- https://www.gnu.org/software/parallel/parallel_tutorial.html
- https://www.cyberciti.biz/faq/how-to-run-command-or-code-in-parallel-in-bash-shell-under-linux-or-unix/
- https://saveriomiroddi.github.io/Running-shell-commands-in-parallel-via-gnu-parallel
- https://unix.stackexchange.com/questions/103920/parallelize-a-bash-for-loop
- https://unix.stackexchange.com/questions/101632/running-thousands-of-curl-background-processes-in-parallel-in-bash-script
- https://unix.stackexchange.com/questions/575327/can-gnu-parallel-execute-a-bash-script-25000-times-per-seconds-and-parallel-proc
- https://opensource.com/article/18/5/gnu-parallel
- https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1
- https://ubuntuforums.org/showthread.php?t=1235238
- https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=20213
- https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=9155
- https://stackoverflow.com/questions/51922126/how-to-format-date-and-time-with-imagemagicks-identify-utility
- https://stackoverflow.com/questions/26654709/extract-exif-data-as-text-using-imagemagick
- https://stackoverflow.com/questions/8707694/batch-resize-images-into-new-folder-using-imagemagick
- https://askubuntu.com/questions/135477/how-can-i-scale-all-images-in-a-folder-to-the-same-width
- https://askubuntu.com/questions/1068850/resize-multiple-images-with-imagemagick-from-a-folder-to-other-and-keep-the-nam
- https://gordonlesti.com/imagemagick-resize-all-images-in-a-directory
- https://legacy.imagemagick.org/Usage/resize/#sample
- https://askubuntu.com/questions/135477/how-can-i-scale-all-images-in-a-folder-to-the-same-width
- https://askubuntu.com/questions/135477/how-can-i-scale-all-images-in-a-folder-to-the-same-width
- https://askubuntu.com/questions/673615/imagemagick-convert-command-cannot-use-fonts
- https://legacy.imagemagick.org/Usage/fonts/
- https://codereview.stackexchange.com/questions/88516/bash-script-that-checks-if-font-is-installed-and-installs-it-if-necessary
- https://techstreams.medium.com/git-google-drive-simple-git-host-3a84db4fc1fd
- https://github.com/labbots/google-drive-upload
- https://towardsdatascience.com/uploading-files-to-google-drive-directly-from-the-terminal-using-curl-2b89db28bb06
-
identify -format '%[EXIF:*]' image.jpg
-
datetime=$(identify -format "%[EXIF:DateTime]" P1050001.JPG | tr " " "_" | tr ":" "-")
-
inname=$(identify -format "%t" P1050001.JPG)
-
convert P1050001.JPG ${inname}_${datetime}.jpg
-
:: Add the date the photo was taken to the image
-
convert %1 -pointsize 20 -fill black -gravity northwest ^
-
-annotate +0+0 "Date: %DateTime%" "%~p1date_%~n1.jpg"
-
convert fotosin\*.jpg -font Arial -pointsize 32 -fill white -annotate +30+50 %[exif:DateTimeOriginal] \fotosout
convert -define jpeg:size=250x200 *.jpg -thumbnail 250x200^ -gravity center -extent 250x200 crop/thumbnail-%d.jpeg
for i in `ls -1 *jpg`; do convert -resize 50% $i "thumb_$i"; done
convert image_file.png -resize 300x300 image_file_resize.png
convert "images/*.jpg[250x]" -set filename:base "%[basename]" "images/new_folder/%[filename:base].jpg"
CC BY-SA 4.0 https://github.com/edzob/photo_scale_timestamp_script