PayPal Hire - Need an Image Sorting Script

Started by BJ1200, March 28, 2012, 07:51:06 AM

Previous topic - Next topic

BJ1200

Hi All,

After cleaning up my image metadata, several hundred had errors and warning messages.

I would be willing to pay someone to write a script that would go through all images in a folder and move those that trigger a warning or error message to another folder. The script should check each image, I don't have all the log error reports. If help comes from this forum, a donation will be made to ExifTool using that spot on bottom of the homepage.

I batch added face coordinates as XMP metadata to all my images. If possible, the script should also move those that don't have XMP face coordinates to another folder. The facial recognition didn't find some faces so there were no coordinates to assign to that image. This will help me find those images so I can reprocess using more aggressive facial-rec settings.

The goal is to move out all problem images and those without XMP face coordinates to other folders so I can fix them. There are about 60 folders, some with up to 18,000 images. There's just no way to manually find and move all these images.

I attached some example files and a PDF with an example. It also shows the warning/error messages the JPG files generated.


Phil Harvey

To move images that generate exiftool warnings to another folder:

exiftool -if "$warning" -directory="SOME FOLDER NAME" DIR

Where DIR is the directory containing the images.  Add -r to also process images in sub-directories.  Use single quotes instead of double if you are on Mac or Linux.

You can easily add a check for face recognition tags in the -if logic if you know what tag names to check.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ryerman

Here's a suggestion:

Record the original directory to make it easier to return the image to its original location.
Add -SOME_TAG_NAME<directory to your command.

After fixing, execute a command that includes -directory<SOME_TAG_NAME to return the images to their original folders.

Jim

Windows 10 Home 64 bit, Exiftool v12.61

BJ1200

Thanks guys. Dang....I knew this would happen. I am not a developer, not familiar with CMD prompt stuff. This is why I use the ExifGUI. I'm not even sure where to enter this line of code so I will have to use the GUI ExifTool Direct area. I believe I drop the exiftool prefix. 

If Images are in:   C:\Users\BJ12\Volunteer Images
An bad images go here:   C:\Users\BJ12\Volunteer Images\Repaired

The correct code entered in the GUI would be:
-if "$warning" -directory="Repaired" C:\Users\BJ12\Volunteer Images


There is a field called "FaceInfoFaceRectangle" under the XMP-AnVoItPicasa category of XMP data. If this field exists, and there are no error messages, this image is good to go. Not sure how to incorporate a check for this field. (Screenshot is in attached PDF file.

I have already processed images using -r but eventually chickened out. I went back and used the GUI, manually checked the box for metadata removal, each folder one by one.

BJ1200

Quote from: ryerman on March 28, 2012, 10:41:10 AM
Record the original directory to make it easier to return the image to its original location.
Add -SOME_TAG_NAME<directory to your command.

Jim
Thanks Jim. For some reason I'm scared to death of using CMD stuff. I've had a few bad experiences. I will probably use cut/paste. If I can't see it happen I tend to get paranoid it dldn't...or won't...or can't...or wrong place...or...  Get the personality profile picture here?

BJ1200

Quote from: Phil Harvey on March 28, 2012, 09:41:57 AM
To move images that generate exiftool warnings to another folder.....:
- Phil
Thanks Phil - 1st donation already sent.
Confirmation number: 5WW73197U8593773S

BogdanH

Hi,

Some had bad experience when using ExifToolGUI on very large amount of files (don't ask me why, because I don't have that many files to tryout). So, it is a good advice, you first tryout on smaller amount of files -so you can see/confirm, that the command does what you want. But, no matter what, if single folder contains several thousand of files (!?), then I would process such folder(s) individually; without -r option. In this case, if something goes wrong, it is esier to determine the reason (where and why) and repeat process if necessary.

Bogdan

BJ1200

#7
Thanks everyone. I will need to set up a buffet with open bar to payback everyone.

All Images are in:   C:\Users\BJ12\Volunteer Images
Bad images should be moved to here:   C:\Users\BJ12\Volunteer Images\Repaired

Is this the correct code to enter in EXiftTool Direct area of the GUI:
-if "$warning" -directory="Repaired" C:\Users\BJ12\Volunteer Images
(The above code did not work. It didn't move any bad files. It said 0 file read)

What is the code to check tag named "FaceInfoFaceRectangle" exists in the metadata. If this field name does not exist, the code must move the image to another folder. Phil suggested this was possible but well over my head. Below shows the tag location. 



Phil Harvey

The command to move the non-FaceInfosFaceRectangle (note the "s" you missed in your discription, but that appears in your screen cap) images is:

exiftool -if "not $FaceInfosFaceRectangle" -directory="SOME OTHER FOLDER" DIR

I'll let Bogdan handle the GUI questions. :)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

#9
Hi,

No, no... don run away Phil; I'm afraid, your knowledge is required here  :) I'm not that familiar with commands for sorting/moving files with ExifTool and I just hope it will work via ExifTool direct as expected.
In this case, there are only two things needed to keep in mind:
1. Just commands/options must be written (without "exiftool" at the beginning).
2. If working on folders/directories and -r option is not used, then no file should be selected in Filelist panel. If -r option is used, then selected folder in Browse panel is automatically used for DIR (source directory) -means: DIR shouldn't be specified in this case.

Bogdan

Phil Harvey

I'm not running away. :)

I was just hoping you would describe how the directory selection process works in the GUI, which you did.  Thanks.

What about the quoting though?  Is this what should be entered in the GUI?:

-if "$warning" -directory="Repaired" "C:\Users\BJ12\Volunteer Images"

Also, in the GUI, I believe that the working directory is set to the currently selected folder when running exiftool direct commands.  So directory names in the command ("Repaired") will be relative to this directory, right?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

Hi Phil,

Quote..in the GUI, I believe that the working directory is set to the currently selected folder when running exiftool direct commands.
Yes. For example, if currently selected folder is "c:\Photos" and executing ExifTool direct, this is the same as "being" in that folder (in console window)
c:\Photos>_
..and executing ExifTool.
And if no file is selected in Filelist panel, then GUI expect, files (path) will be specified at the end of command/options -just like if exiftool is executed in console.

Bogdan

BJ1200

#12
Quote from: Phil Harvey on March 28, 2012, 04:23:38 PM
What about the quoting though?  Is this what should be entered in the GUI?:
-if "$warning" -directory="Repaired" "C:\Users\BJ12\Volunteer Images"
- Phil

I tried the above, even tried using the full path after-directory. Nothing happened but it said said "0 image files read" at the bottom of the GUI. No bad images were moved, no log was produced. So I tried adding exiftool to the beginning. Nothing was moved, but it does generate a log below (Using a small test folder of images for now).

Also, shouldn't it be "$error or $warning" or something like that so it can find images with either problem?

1 directories scanned
    9 files failed condition
    0 image files read
    1 files could not be read
File not found: exiftool
<-END-



THE XMP DATA WORKED! :) Moved images that don't have the FaceInfosFaceRectangle field. I had to enter the full directory path in both locations. When I didn't enter the full path after -directory=, it would delete all images (or it moved all of them to a place I have yet to find).
-if "not $FaceInfosFaceRectangle" -directory="C:\Users\BJ12\Volunteer Images\Repaired" "C:\Users\BJ12\Volunteer Images"


BogdanH

Parameter -directory is the directory to where files should be moved. If you use -directory= only, without specifying it's path/name, then (I assume) particular files in source directoy (the last specification) will be deleted.
If directory names contain spaces (i.e. ..Volunteer images) then whole parameter must be in double quotes. There are few examples here: https://exiftool.org/gui/#p_etdirect

Bogdan

Phil Harvey

Quote from: BJ1200 on March 28, 2012, 07:59:56 PM
I tried the above, even tried using the full path after-directory. Nothing happened but it said said "0 image files read" at the bottom of the GUI. No bad images were moved, no log was produced. So I tried adding exiftool to the beginning. Nothing was moved, but it does generate a log below (Using a small test folder of images for now).

Also, shouldn't it be "$error or $warning" or something like that so it can find images with either problem?

1 directories scanned
    9 files failed condition
    0 image files read
    1 files could not be read
File not found: exiftool
<-END-

I don't know why you didn't get a log before you added "exiftool" to the parameters (which shouldn't be there btw).  Perhaps bogdan can answer this.

After adding exiftool, the log shows that 9 files failed the condition.  So if the condition was -if "$warning", then the files didn't have a warning.  You can test for errors too if you want, exactly as you specified above.

QuoteWhen I didn't enter the full path after -directory=, it would delete all images (or it moved all of them to a place I have yet to find).

Setting -directory= should do nothing.  There must be something else going on here.

Quote from: BogdanH on March 29, 2012, 01:18:27 AM
If you use -directory= only, without specifying it's path/name, then (I assume) particular files in source directoy (the last specification) will be deleted.

No.  I'm not that cruel. :P

In fact, there should be no way to get exiftool to delete a file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).