Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
27
votes
5
answers
22883
views
Rename images to exif time: Make unique filenames
If I rename images via exiv to the exif date time, I do the following: find . -iname \*jpg -exec exiv2 -v -t -r '%Y_%m_%d__%H_%M_%S' rename {} \; Now it might happen that pictures have exactly the same timestamp (including seconds). How can I make the filename unique automatically? The command shoul...
If I rename images via exiv to the exif date time, I do the following:
find . -iname \*jpg -exec exiv2 -v -t -r '%Y_%m_%d__%H_%M_%S' rename {} \;
Now it might happen that pictures have exactly the same timestamp (including seconds). How can I make the filename unique automatically?
The command should be stable in the sense that if I execute it on the same directory structure again (perhaps after adding new pictures), the pictures already renamed shouldn't change and if pictures with already existing filenames are added the new filenames should be unique as well.
My first attempt was just to leave the original basename in the resulting filename, but then the command wouldn't be stable in the sense above.
student
(18865 rep)
Oct 1, 2017, 07:04 AM
• Last activity: Mar 17, 2025, 07:25 PM
4
votes
1
answers
2817
views
How to rename all files and add image size to file name
I can't make this work. I have a lot of images and i want to rename his name and append image size to name using `exiv2` `exiv2 pr *` prints all info about file # exiv2 pr 9b523e5a002268fe5067a928 File name : 9b523e5a002268fe5067a928 File size : 356433 Bytes MIME type : image/jpeg Image size : 1920...
I can't make this work. I have a lot of images and i want to rename his name and append image size to name using
exiv2
exiv2 pr *
prints all info about file
# exiv2 pr 9b523e5a002268fe5067a928
File name : 9b523e5a002268fe5067a928
File size : 356433 Bytes
MIME type : image/jpeg
Image size : 1920 x 1200
Now i want rename my file to look like
9b523e5a002268fe5067a928_1920x1200.jpeg
I already make something like this
exiv2 pr * | grep "Image " | awk -F':' '{ print $2 }' | sed 's/ //g'
It gives me the image size, but how do i extend this to get the image MIME type to get the .jpeg correct ?
SimpleSpawn
(143 rep)
Oct 11, 2012, 10:11 AM
• Last activity: Jan 6, 2023, 11:58 PM
9
votes
2
answers
4846
views
Print specific Exif image data values with exiv2
How do I print the image Exif date with a tool like `exiv2`? My goal is to write the image year and month into separate variables. Do I really have to parse the output with regex or is there a alternative to something like this: exiv2 DSC_01234.NEF -ps | grep 'Image timestamp' | ...regex to parse th...
How do I print the image Exif date with a tool like
exiv2
?
My goal is to write the image year and month into separate variables. Do I really have to parse the output with regex or is there a alternative to something like this:
exiv2 DSC_01234.NEF -ps | grep 'Image timestamp' | ...regex to parse the date
apparat
(642 rep)
Mar 14, 2011, 08:46 PM
• Last activity: Jan 6, 2023, 11:56 PM
1
votes
1
answers
211
views
Exiv2: How to print tag values without printing the corresponding filenames
I'm using `exiv2` 0.27.2. I want to print the tag values of multiple `webp` files, but without the filename being printed. With the following command: exiv2 -g Exif.Image.Artist -Pv *.webp I get the following output: 3q2NIGNI_o.webp tomato 3qAwrJWu_o.webp orange 3qDZg9vz_o.webp cantelope I just want...
I'm using
exiv2
0.27.2. I want to print the tag values of multiple webp
files, but without the filename being printed.
With the following command:
exiv2 -g Exif.Image.Artist -Pv *.webp
I get the following output:
3q2NIGNI_o.webp tomato
3qAwrJWu_o.webp orange
3qDZg9vz_o.webp cantelope
I just want the tag name output, without the filename, like so:
tomato
orange
cantelope
whitewings
(2527 rep)
Jan 5, 2023, 11:52 AM
• Last activity: Jan 5, 2023, 09:21 PM
Showing page 1 of 4 total questions