Re: find lost jpegs
- From: jellybean stonerfish <stonerfish@xxxxxxxxxxxxx>
- Date: 20 Jun 2009 18:32:28 GMT
On Sat, 20 Jun 2009 08:25:43 -0600, davidoznot wrote:
Let's say I have a favorite jpeg image scaled down to 640 pixels wide.<SNIP>
This favorite image has a name "myimage.jpg"
But I cannot find the raw original, as it came off the camera, probably
more like 4000 pixels wide. I suspect I still have this image
somewhere, probably with a name like dscn_1492.jpg
<SNIP>
Is it possible to write a program (perhaps in bash and perl) that could
read something of the jpeg header of the scaled-down copy, and use that
as a search key for examining all the others?
....anybody know how to do this?
exiftags is one way of getting the exif tag information in a text format.
If your image editing software used to create the scaled image did not
change the "Unique Image ID" tag then you could do something like this.
exiftags scaled.JPG | grep Unique
On my computer returns:
exiftags: field count mismatch (ImageUniqueID)
Unique Image ID: d401B0064000111E1D7D811000000000
Ignoring the error message, (field count mismatch) I searched my Picture
directory for the string "d401B0064000111E1D7D811000000000" and found the
original file.
grep -rl d401B0064000111E1D7D811000000000 Pictures
On my computer returns:
Pictures/alison_camera/2008-02-24--09.58.19/HPIM0001.JPG
With a tiny bit of playing, I can extract the "Unique Image ID" tag from
the scaled file:
exiftags scaled.JPG 2> /dev/null| grep Unique | cut -d' ' -f4
Returns:
d401B0064000111E1D7D811000000000
Putting the above command into the command that searches the Pictures
directory makes a one liner. ( two liner because or line length. )
grep -rl $(exiftags scaled.JPG 2> /dev/null | grep Unique |
cut -d' ' -f4) Pictures
Returns:
Pictures/alison_camera/2008-02-24--09.58.19/HPIM0001.JPG
It should be easy to put in a script.
cat /home/js/bin/findorigpic
#!/bin/sh
# Search directory for images with "Unique Image ID" maching image
# Usage fiorigpic image directory
grep -rl $(exiftags $1 2> /dev/null| grep Unique | cut -d' ' -f4) $2
# END OF findorigpic
A test run appears to work:
findorigpic scaled.JPG Pictures
Returns:
Pictures/alison_camera/2008-02-24--09.58.19/HPIM0001.JPG
If your image editing software used to scale the image changed the
"Unique Image ID" tag, then you do the above but using a tag that wasn't
changed.
.
- References:
- find lost jpegs
- From: davidoznot
- find lost jpegs
- Prev by Date: Re: solution tested Re: Filename character translation
- Next by Date: Re: Filename character translation
- Previous by thread: Re: find lost jpegs
- Index(es):
Relevant Pages
|