PayPal Hire - Need an Image Sorting Script

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

Previous topic - Next topic

BJ1200

Hi Bogdan and Phil,

My bad, those 9 files only contain errors (below). I was under the assumption using $warning was a generic term for any problematic file. I will add known warning files and test again.

   3 image files updated
    2 image files unchanged
    4 files weren't updated due to errors
Error: JPEG EOI marker not found - anthony batarse.jpg
Error: Not a valid JPEG (looks more like a PNG) - billy lockwood.jpg
Error: Not a valid JPEG (looks more like a BMP) - Chris Menges.jpg
Error: Not a valid JPEG (looks more like a XMP) - jennifer ellison.jpg

BJ1200

Well this is frustrating. Awhile back I used the GUI to clean metadata and when it was done with a folder it created a log report, similar to the below:

Warning: [minor] Ignored APP1 XMP segment with non-standard header - Matt Stone.jpg
Warning: Multiple Photoshop records - Melody Noel.jpg
Error: Not a valid JPEG (looks more like a GIF) - Mike Bailey.jpg
Warning: Multiple Photoshop records - Mike Rembis.jpg
Warning: [minor] Ignored APP1 XMP segment with non-standard header - Miles Chalmers.jpg


I have manually extracted many of the images in the log that were listed as "Warnings" to use as test images. Using the code to find $warning images does not detect them. So I processed these images again that produced the original log - using the GUI to remove all metadata. To my surprise, none show up on the log as "warning" images. I suspect cleaning the metadata the first time fixes some of them, but I can't find one with a warning message.

BJ1200

I'm not able to get this to work, to scan for images with warning or errors, then move the. It moves all images, not just those with errors or warnings. Here's the log:

======== –if
======== $error or $warning
    1 directories scanned
   22 image files updated
    2 files weren't updated due to errors
Error: File not found - â€"if
Error: File not found - $error or $warning
<-END-

Phil Harvey

#18
In hour last post it looks to me as if you are using some funny Unicode character instead of a simple dash in "-if".  Try typing simple dash.

- Phil

Edit: I meant "your", not "hour".
...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 ($).

BJ1200

Quote from: Phil Harvey on March 30, 2012, 07:13:32 AM
In hour last post it looks to me as if you are using some funny Unicode character instead of a simple dash in "-if".  Try typing simple dash.
- Phil
Hmm, good catch. However, that dash works with the code for moving images without XMP fields. I create the long string of code in Word and found the " signs are problamatic. When pasted into ExifTool Direct I have to delete those " and type them again. Then it works fine. I will try and change the dash.

BJ1200

Hi Phil,

These must be two distinctly different evaluations for errors and warnings. Using the GUI to remove all metadata picks up (logs) substantially more errors than using -if "$error".

Using the GUI to remove all metadata (Log results):
0 image files updated
15221 image files unchanged
   15 files weren't updated due to errors
Error: Not a valid JPEG (looks more like a PNG) - Adam McKay.jpg
Error: JPEG EOI marker not found - Alicia Leigh Willis.jpg
Error: Not a valid JPEG (looks more like a PNG) - Cliff De Young.jpg
Error: JPEG EOI marker not found - Colleen Kelly.jpg
Error: Not a valid JPEG (looks more like a PNG) - Ed Gale.jpg
Error: JPEG EOI marker not found - George Fisher.jpg
Error: Not a valid JPEG (looks more like a GIF) - Gert Fröbe.jpg
Error: JPEG EOI marker not found - Hannah Rebecca Telle.jpg
Error: JPEG EOI marker not found - Marisa Petroro.jpg
Error: Not a valid JPEG (looks more like a GIF) - Michael Goodliffe.jpg
Error: Not a valid JPEG (looks more like a GIF) - nolan hemmings.jpg
Error: JPEG EOI marker not found - Patrick Stevenson.jpg
Error: JPEG EOI marker not found - Sandra Nelson.jpg
Error: Not a valid JPEG (looks more like a GIF) - susan vidler.jpg
Error: Not a valid JPEG (looks more like a BMP) - Thomas Gottschalk.jpg
<-END-


Now the same folder using the -if "$error" method in ExifDirect:
  1 directories scanned
15236 files failed condition
    0 image files read
    1 files could not be read
File not found: C:/Users/Media/J??rgen Prochnow.jpg
<-END-




Phil Harvey

I should have mentioned this.  I didn't realize the errors you were getting were while writing.

The -if "$error" will be true only for files that give errors when reading, which is very different than when writing.  Many errors when writing are only warnings when reading, and you will get some warnings when writing that you don't get when reading.  This is because the conditions to successfully write an image are more strict than for reading.

It is more difficult if you want to identify all of the images which give write errors.  Also, some write errors won't show up unless you write the specific type of metadata which generates the error.  For example, a JPEG image with corrupted EXIF won't generate errors if you write XMP only.  So the whole thing is much more complicated if this is what you are asking, and in this case I don't know of a good way to do what you want.

- 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 ($).