ii/image


exif

exif

Commandes exif
Commande Explication
Date
# Modifier ou créer la date des fichiers jpg du sossier courant
d="2026:01:22 22:00:00"; exiftool -overwrite_original -DateTimeOriginal="$d" -CreateDate="$d" -ModifyDate="$d" *.jpg
Description
# Modifier ou créer la description des fichiers jpg du sossier courant
desc="Slam Ma Bouteille s appelle reviens"; exiftool -overwrite_original -ImageDescription="$desc" *.jpg
Voir les descriptions
exiftool -ImageDescription -XPComment -UserComment *jpg
                       

exemples

exemples

# Titre Desc
1Framelapse Reims 14è
2Ciel de Reims du 7 mai 2021

vrac

scan_en_1_click

Fichier $USER/bin/scan_en_1_click.sh

Scan en 1 clic d'une feuille A4



# scan 1 clic sur DOT S avec Canon scanner à plat - Linux Mint
scangearmp2 &
sleep 3

# première boite scanner
echo xdotool mousemove 574 331
xdotool mousemove 574 331
sleep 1
echo 'xdotool mousedown 1; xdotool mouseup 1'
xdotool mousedown 1; xdotool mouseup 1
sleep 2

# bouton numériser (JPEG)
echo xdotool mousemove 522 400
xdotool mousemove 522 400
sleep 1
echo 'xdotool mousedown 1; xdotool mouseup 1'
xdotool mousedown 1; xdotool mouseup 1
sleep 2

# nom fichier
xdotool mousemove 651 203
sleep 1
xdotool mousedown 1; xdotool mouseup 1
sleep 2
# effacer nom
for i in $(seq 1 1 20); do xdotool key BackSpace; done
xdotool type scan_auto$(date +%H_%M_%S)
sleep 1
# lancer skan
xdotool mousemove 708, 390; sleep 1; xdotool mousedown 1; xdotool mouseup 1

annoter_images_taille_dyn

Télécharger le script

# annoter_images_taille_dyn.sh

# source : http://gangand.net/ii/image

# annoter des images en fonction de la taille de chaque image

# https://stackoverflow.com/questions/58621445/imagemagick-how-to-create-an-annotation-that-would-fit-its-size-into-any-image?newreg=53997a2d9b724f1fb5c70113ea3c1332

# ==========================================================
# Using ImageMagick version 6 or 7 you can make a label sized to fit any input image, with a semi-transparent background, and composite it at the bottom of the input image to get the result you describe. Here is a command with IM 6 that does it...
# 
# convert input.png -set option:size %[w]x \
#    -fill white -background "#00000080" \
#    \( label:"This is my text." \
#       -virtual-pixel background -distort SRT "0.8 0" \
#       -virtual-pixel none -distort SRT "0.8 0" \) \
#    -gravity south -composite result.png
# That uses the width of the input image "%[w]" to set the width of the label. It sets the text color to white and the background to semi-transparent black, "#00000080".
# 
# Inside the parentheses it creates your label. It uses "distort SRT" to scale the label down a bit to pull it in from the edges. Then it scales the label down a bit more to add some transparent space around it.
# 
# After the label is created it sets the gravity to "south" and composites the label onto the input image. It finishes by writing the output file.
# 
# Using IM 7 you'll need to change "convert" to "magick". For Windows change the continued line backslashes "\" to carets "^" and get rid of the backslashes that escape the parentheses.
# 
# Edited to add: Normally you'd use "-size WxH" ahead of making a "label:" to constrain it within particular dimensions. I used "-set option:size" instead because it allows for using percent escapes like "%[w]" with IM 6. That way the label dimensions are relative to any input image width.
# ==========================================================

ls -1 *jpg | sort > /tmp/annoter_images_taille_dyn.txt
workdir=/tmp/annoter_images_taille_dyn_$(date "+%A_%e_%h_%Y-%Hh%Mmn%Ss")
mkdir $workdir

# 1. copier les images
echo $(date) Pour afficher seulement les commandes prévues, ajouter echo en 1er paramètre
echo $(date) 1. copie jpg
while read jpg; do
    cp $jpg $workdir
done < /tmp/liste_jpg.txt

# 2. annoter les images
echo $(date) 2. annotation
cd $workdir

# annotation nom fichier complet, extension comprise
# ls -1 *.jpg | xargs -i convert {} -set option:size %[w]x \
#   -fill white -background "#00000080" \
#   \( label:"{}" \
#      -virtual-pixel background -distort SRT "0.8 0" \
#      -virtual-pixel none -distort SRT "0.8 0" \) \
#   -gravity south -composite {}


cp /tmp/annoter_images_taille_dyn.txt $workdir
while read jpg; do
echo "$(date)    annotation $jpg"

    f=$(echo "$jpg" | sed 's/.jpg//')
    $1 convert $jpg -set option:size %[w]x \
   -fill white -background "#00000080" \
   \( label:"$f" \
      -virtual-pixel background -distort SRT "0.8 0" \
      -virtual-pixel none -distort SRT "0.8 0" \) \
   -gravity south -composite $jpg
done < annoter_images_taille_dyn.txt


# 3. résultat
echo $(date) 3. fichiers créés dans $workdir 
nemo $workdir &
        

annoter_images_video

# images2video.sh

# source : http://gangand.net/ff/formation/notes/system_partie_1.html

# création d'une vidéo serie_HH_MM_SS.avi
# depuis les images du dossier courant

# utile suite à la capture d'images par motion
# sur Raspberry Pi (oiseaux venant boire)
ls -1 *jpg | sort > /tmp/liste_jpg.txt
n=10000
mkdir /tmp/video_ffmpeg

# 1. copier les images
echo $(date) 1. copie jpg
while read jpg; do
    cp $jpg /tmp/video_ffmpeg/serie-$n.jpg
    n=$((n+1))
done < /tmp/liste_jpg.txt

# 2. annoter les images
echo $(date) 2. annotation
cd /tmp/video_ffmpeg
ls -1 *.jpg | xargs -i convert {} -fill white \
 -undercolor '#00000080' \
 -gravity South \
 -annotate +0+5 {} {}

# 3. créer une vidéo
echo $(date) 3. ffmpeg
ffmpeg -f image2 -i serie-1%04d.jpg -r 12 serie.avi

# 4. nettoyer
echo $(date) 4. nettoyage
mv serie.avi serie_$(date '+%Hh%Mmn%S').avi
#~ rm /tmp/liste_jpg.txt
#~ rm -rf video_ffmpeg

# 5. annoncer résultat
echo $(date) 5. fichier .avi créé dans $(pwd)
        

timelapse4s.sh

# timelapse4s.sh

# source : https://gangand.net/ii/image/

# création de vidéos mp4
# depuis les images du dossier courant

basenom=$(basename $(pwd))
tmpdir=/tmp/TIMELAPSE4S_$(date "+%A_%e_%h_%Y-%Hh%Mmn%Ss")
workdir=${tmpdir}/${basenom}
mkdir ${tmpdir} 2>/dev/null
mkdir ${workdir} 2>/dev/null
ls -1 *jpg | sort > ${workdir}/liste_jpg.txt

# 1. copier les images (annotées par annoter_images.sh)
echo "$(date) 1. copie jpg dans ${workdir}"
cp *jpg ${workdir}

# 2. renommer les images
echo $(date) 2. renommer images en serie-...
cd ${workdir}
nbimages=0
n=10000
while read jpg; do
    mv $jpg serie-$n.jpg
    n=$((n+1))
    nbimages=$((nbimages+1))
done < ${workdir}/liste_jpg.txt
echo "$(date)    renommé ${nbimages} images"

# 3. créer une vidéo
ffmpeg -framerate 0.25 -i serie-1%04d.jpg -codec copy timelapse4s.mp4

# pour une image toutes les 2 secondes
# ffmpeg -framerate 0.5 -i serie-1%04d.jpg -codec copy timelapse2s.mp4

# pour une image toutes les secondes
# ffmpeg -framerate 1 -i serie-1%04d.jpg -codec copy timelapse1s.mp4

ffmpeg -hide_banner -i timelapse4s.mp4 -c:v libx264 -x264-params crf=25            timelapse4s.x264.supercompat.mp4
ffmpeg -hide_banner -i timelapse4s.mp4 -c:v libx264 -x264-params crf=25 -s 960x540 timelapse4s.960x540.x264.supercompat.mp4

# 4. nettoyer
echo "$(date) 4. nettoyage"
rm ${workdir}/liste_jpg.txt