Recursive PreviewImage Output

Started by Archive, May 12, 2010, 08:53:50 AM

Previous topic - Next topic

Archive

[Originally posted by way2real on 2005-09-22 17:41:44-07]

Windows XP

ExifTools 5.63

ActivePerl

I have a lot of NEF and CR2 files on DVD.  I am trying to use Recursive PreviewImage to capture jpegs for each of the raw images.

Here is my problem - How do I redirect the output of PreviewImage to c:\ (a writable media)?

Thanks for any help.

Archive

[Originally posted by exiftool on 2005-09-22 18:33:49-07]

Unfortunately 'exiftool' is only currently designed to write the preview images to the same directory as the original when using the recursive option.

If I can think of a way to do it easily, I will add this ability to exiftool

However, until then you can achieve this using a bit of shell magic:

1) Type "foreach file ( `find DIR | grep .NEF` )", where DIR is the name of the directory with the NEF images (assuming their extension is '.NEF'). Watch that you use the proper backticks around the 'find' command.

You should then be prompted to enter the commands to execute in the 'foreach' loop:

2) Type "exiftool -previewimage -b $file > OUTDIR/`basename $file`.JPG", where OUTDIR is your output directory name.

3) Type "end" to end the 'foreach' loop.

This should extract all of the preview images and place them in the same output directory with names that end in '.NEF.JPG'.

I hope this helps.

Archive

[Originally posted by exiftool on 2005-09-22 18:41:52-07]

Oh, wait.

You need to be in a Unix shell for this to work.  This would work on Windows XP if you have Cygwin or some other Unix installed, but I don't think you have this if you are just running ActivePerl.

Maybe someone who knows XP better can tell us if this is possible.

Otherwise, my guess is the only way is for me to add the functionality to exiftool.  I'll see what I can do.

Archive

[Originally posted by way2real on 2005-09-22 19:37:32-07]

Thank you for answering.  I will play with Cygwin and see what I can do with that.

I know I would love an output destination feature for PreviewImage.  While I am wishing... it would be really cool, too, if preserving the directory stucture of the output were also an option.

Thanks again.

Archive

[Originally posted by exiftool on 2005-09-22 20:55:30-07]

I've figured out a cool way to expand the -w option to do what you want.

With the improved -w command, you can do what you want like this:  First change to the base directory containing the source images, then type:

Code:
   exiftool -previewimage -b -w DIR/%0%1.jpg .

Where DIR is the name of the output directory.  This should scan the current directory for any image containing a preview, then write the previews to the specified output directory with a ".jpg" extension.  This should even preserve the directory structure as you requested.

This feature will appear in version 5.64 when it is released, but I have made a pre-release available for you to test at https://exiftool.org/Image-ExifTool-5.63.tar.gz" target="_blank">https://exiftool.org/Image-ExifTool-5.63.tar.gz. Let me know how it works for you.

Archive

[Originally posted by exiftool on 2005-09-22 20:57:20-07]

Ooops.  sorry.  the URL for the pre-release should have been:

https://exiftool.org/Image-ExifTool-5.64.tar.gz" target="_blank">https://exiftool.org/Image-ExifTool-5.64.tar.gz

Archive

[Originally posted by way2real on 2005-09-23 03:44:16-07]

Dude, you rock!  That does exactly what I was wanting.  I think alot of other people will benefit from it also.

For anyone interested, on my Windows machine, this is what I ended up with:

First change to the base directory containing the source images, then type:

Code:
 perl C:\PATH\TO\exiftool -PreviewImage -b -w C:\OUTPUT\DIR\%0%1.jpg -r .
As promised, this traverses the source directory tree creating a parrallel output directory tree with jpeg files.

Does %0 and %1 have to be those values?  I am pretty sure MS batch files use those variables for path and/or directory names (I think).  If they have to be what they are, that is fine.

Monday, I will run this on a 200GB drive with a fairly extensive directory tree.  I will let you know how it goes.

Thanks again

Archive

[Originally posted by exiftool on 2005-09-23 11:32:57-07]

Great.  Glad it is working so far.

If %0, %1 and %2 cause problems for you in batch files, it may be possible to use quotes around the argument to prevent this.  It certainly doesn't have to be %0, %1 and %2, but these made a bit of sense to me (probably because I had used them in batch files...).  I'm open to suggestions if you have a better idea.  We are free to change this until 5.64 is released officially (probably some time next week).

Archive

[Originally posted by way2real on 2005-09-24 03:20:27-07]

I have tried double and single quotes and back tics but the batch file still gets confused.

If %0, %1 , %2 = directory, file name, extention

could %d, %f (or %n), %e = directory, file name, extention

or could %sd, %sf (or %sn), %se = source directory, source file name, source extention

Sorry, this is the best I could come up with.  If you want to mess with this, that would be great.  If not, I totally understand.

Archive

[Originally posted by exiftool on 2005-09-25 17:37:45-07]

After thinking about it for a bit, I think I like %d %f and %e.  I have updated the pre-release version to use these instead of %0, %1, %2.

Thanks for the suggestion.

Archive

[Originally posted by way2real on 2005-09-26 18:55:27-07]

I ran this on one of my 200GB drives today.  I used the current pre-release of v.5.64.  Everything went great.

19,013 Files

183 Folders

37 Minutes

Thanks you for a great piece of software.

Archive

[Originally posted by exiftool on 2005-09-26 19:56:11-07]

You're welcome.  Glad everything went OK.

Wow, that's a lot of files!  It works out to 8.5 files/sec -- a bit on the slow side when processing tens of thousands of files, but not to bad considering how much work ExifTool does.

Archive

[Originally posted by way2real on 2005-09-27 14:56:23-07]

I am really sorry about making extra work for you.  It turns out the % character is a reserved character and is what confused the batch file.  The % can be escaped with another %, resulting in %%d%%f (or %%0%%1 would have worked).

Archive

[Originally posted by exiftool on 2005-09-27 15:33:59-07]

OK, that's good you've figured out how to get it to work in a batch file.  It was easy to change, and I think I like it better now anyway, so no apologies necessary.

Archive

[Originally posted by way2real on 2006-02-12 13:49:59-08]

Is it possible for the preview image to obey the orientation tag (or whatever rotates the image)?