I'm looking to use Python to iterate through all the files in a folder and run the exiftool command on each file, so in the end I should have x amount of files each with their own exiftool output to run grep commands on.
I have long used wonderful exiftool to strip out exif data from images. Up to now, I've always done that in the same directory. Now I'd like to make it place the exif-stripped file in a different directory, and add a "my-original-file-name-NO-EXIF.jpg" in there. (The key thing is I want NO-EXIF to be AFTER the original file, but before the .jpg).
You can run ExifTool by running ./exiftool in the ExifTool directory or proceed to the next step if you want to install it system-wide. You must have Perl installed on your Linux box before compiling.
The -b option tells exiftool to output data in binary format and extract.jpg is the destination file of the new image created. You can replace -PreviewImage with -ThumbnailImage if you want a thumbnail instead.
Questions:
- Is the exiftool_path value supposed to be a relative or absolute path? Does this point to the "exiftool" executable or to the folder that contains the executable?
- What am I doing wrong?
The image rotation is (or may be) a different issue. First I want to figure out why piwigo isn't recognizing exiftool. Here's my current situation ..
- exiftool is available via the OS, I can type "exiftool -ver" at the command line in a terminal window and it reports the version as 12.58
- I've commented out all "exif" settings that I set earlier in the Local Config. There are no settings defined there at all, now.
- When I go to the piwigo dashboard I see the following two anomalies:
+ $conf['show_exif'] value is incorrect because exif are not supported
+ $conf['use_exif'] value is incorrect because exif are not supported
- When I go to Photos > Add, I see the following message ..
"Exif extension not available, admin should disable exif use"
Any ideas?
Another utility worth looking into is exiftool. It might not be the right tool in your specific case as it doesn't report any information on the geometry of the document but in general it is probably the most feature-complete tool for inspecting PDF metadata.
OK. Why you get "List index out of bounds(0)"? Because "CreateProcess" command was called (meaning: exiftool.exe was called from GUI). Let us stay with clicking on "About..." menu. When GUI calls ExifTool, there's some "answer" expected (ExifTool version number, in this case).
GUI is "prepared" on two situations:
Third situation is, when you get "List index out...", which can have a lot of reasons, where I'm 99.99% sure are related to preparation/execution of CreateProcess command inside Wine. Btw. if that message would happen on Windows, I would say: GUI recieved something, but can't handle received data or does that in a wrong way.
Hmmm... is there any other Win emulator for linux?
We add the Testing into our code so that when we look at our preview later we can verify the page is at least loading correctly. We can then use exiftool to verify our image has been updated:
A command-line interface to Image::ExifTool, used for reading and writing meta information in a variety of file types. FILE is one or more source file names, directory names, or "-" for the standard input. Metadata is read from source files and printed in readable form to the console (or written to output text files with -w). To write or delete metadata, tag values are assigned using the -TAG=[VALUE] syntax, or the -geotag option. To copy or move metadata, the -tagsFromFile feature is used. By default the original files are preserved with "_original" appended to their names --- be sure to verify that the new files are OK before erasing the originals. Once in write mode, exiftool will ignore any read-specific options.
Case is not significant for any command-line option (including tag and group names), except for single-character options when the corresponding upper-case option exists. Many single-character options have equivalent long-name versions (shown in brackets), and some options have inverses which are invoked with a leading double-dash. Unrecognized options are interpreted as tag names (for this reason, multiple single-character options may NOT be combined into one argument). Contrary to standard practice, options may appear after source file names on the exiftool command line. Option Summary Tag operations -TAG or --TAG Extract or exclude specified tag -TAG[+-]=[VALUE] Write new value for tag -TAG[+-]
A special feature allows the copy number to be incremented for each processed file by using %C (upper case) instead of %c. This allows a sequential number to be added to output file names, even if the names are different. For %C, a copy number of zero is not omitted as it is with %c. The number before the decimal place gives the starting index, the number after the decimal place gives the field width. The following examples show the output filenames when used with the command "exiftool rose.jpg star.jpg jet.jpg ...":
Among other things, the advanced options allow complex processing to be performed from a single command without the need for additional scripting. This may be particularly useful for implementations such as Windows drag-and-drop applications. These options may also be used to improve performance in multi-pass processing by reducing the overhead required to load exiftool for each invocation.
If than one -srcfile option is specified, the files are tested in order and the first existing source file is processed. If none of the source files already exist, then exiftool uses the first -srcfile specified.
This causes ARGFILE to be closed, and NEWARGFILE to be kept open. (Without the -stay_open here, exiftool would have returned to reading arguments from ARGFILE after reaching the end of NEWARGFILE.)
Note: When writing arguments to a disk file there is a delay of up to 0.01 seconds after writing "-execute\n" before exiftool starts processing the command. This delay may be avoided by sending a CONT signal to the exiftool process immediately after writing "-execute\n". (There is no associated delay when writing arguments via a pipe with "-@ -", so the signal is not necessary when using this technique.)
Note: Beware when cutting and pasting these examples into your terminal! Some characters such as single and double quotes and hyphens may have been changed into similar-looking yet functionally-different characters by the text formatter used to display this documentation. Also note that Windows users must use double quotes instead of single quotes as below around arguments containing special characters. exiftool -a -u -g1 a.jpg Print all meta information in an image, including duplicate and unknown tags, sorted by group (for family 1). exiftool -common dir Print common meta information for all images in "dir". "-common" is a shortcut tag representing common EXIF meta information. exiftool -T -createdate -aperture -shutterspeed -iso dir > out.txt List specified meta information in tab-delimited column form for all images in "dir" to an output text file named ``out.txt''. exiftool -s -ImageSize -ExposureTime b.jpg Print ImageSize and ExposureTime tag names and values. exiftool -l -canon c.jpg d.jpg Print standard Canon information from two image files. exiftool -r -w .txt -common pictures Recursively extract common meta information from files in "pictures" directory, writing text output to ".txt" files with the same names. exiftool -b -ThumbnailImage image.jpg > thumbnail.jpg Save thumbnail image from "image.jpg" to a file called "thumbnail.jpg". exiftool -b -JpgFromRaw -w _JFR.JPG -ext NEF -r . Recursively extract JPG image from all Nikon NEF files in the current directory, adding "_JFR.JPG" for the name of the output JPG files. exiftool -a -b -W %d%f_%t%-c.%s -preview:all dir Extract all types of preview images (ThumbnailImage, PreviewImage, JpgFromRaw, etc.) from files in directory ``dir'', adding the tag name to the output preview image file names. exiftool -d '%r %a, %B %e, %Y' -DateTimeOriginal -S -s -ext jpg . Print formatted date/time for all JPG files in the current directory. exiftool -IFD1:XResolution -IFD1:YResolution image.jpg Extract image resolution from EXIF IFD1 information (thumbnail image IFD). exiftool '-*resolution*' image.jpg Extract all tags with names containing the word ``Resolution'' from an image. exiftool -xmp:author:all -a image.jpg Extract all author-related XMP information from an image. exiftool -xmp -b a.jpg > out.xmp Extract complete XMP data record intact from "a.jpg" and write it to "out.xmp" using the special "XMP" tag (see the Extra tags in Image::ExifTool::TagNames). exiftool -p '$filename has date $dateTimeOriginal' -q -f dir Print one line of output containing the file name and DateTimeOriginal for each image in directory "dir". exiftool -ee -p '$gpslatitude, $gpslongitude, $gpstimestamp' a.m2ts Extract all GPS positions from an AVCHD video. exiftool -icc_profile -b -w icc image.jpg Save complete ICC_Profile from an image to an output file with the same name and an extension of ".icc". exiftool -htmldump -w tmp/%f_%e.html t/images Generate HTML pages from a hex dump of EXIF information in all images from the "t/images" directory. The output HTML files are written to the "tmp" directory (which is created if it didn't exist), with names of the form 'FILENAME_EXT.html'. exiftool -a -b -ee -embeddedimage -W Image_%.3g3.%s file.pdf Extract embedded JPG and JP2 images from a PDF file. The output images will have file names like ``Image_#.jpg'' or ``Image_#.jp2'', where ``#'' is the ExifTool family 3 embedded document number for the image.
These examples demonstrate the ability to copy tag values between files. exiftool -tagsFromFile src.cr2 dst.jpg Copy the values of all writable tags from "src.cr2" to "dst.jpg", writing the information to same-named tags in the preferred groups. exiftool -TagsFromFile src.jpg -all:all dst.jpg Copy the values of all writable tags from "src.jpg" to "dst.jpg", preserving the original tag groups. exiftool -all= -tagsfromfile src.jpg -exif:all dst.jpg Erase all meta information from "dst.jpg" image, then copy EXIF tags from "src.jpg". exiftool -exif:all= -tagsfromfile @ -all:all -unsafe bad.jpg Rebuild all EXIF meta information from scratch in an image. This technique can be used in JPEG images to repair corrupted EXIF information which otherwise could not be written due to errors. The "Unsafe" tag is a shortcut for unsafe EXIF tags in JPEG images which are not normally copied. See the tag name documentation for more details about unsafe tags. exiftool -Tagsfromfile a.jpg out.xmp Copy meta information from "a.jpg" to an XMP data file. If the XMP data file "out.xmp" already exists, it will be updated with the new information. Otherwise the XMP data file will be created. Only XMP, ICC and MIE files may be created like this (other file types may be edited but not created). See ``WRITING EXAMPLES'' above for another technique to generate XMP files. exiftool -tagsFromFile a.jpg -XMP:All= -ThumbnailImage= -m b.jpg Copy all meta information from "a.jpg" to "b.jpg", deleting all XMP information and the thumbnail image from the destination. exiftool -TagsFromFile src.jpg -title -author=Phil dst.jpg Copy title from one image to another and set a new author name. exiftool -TagsFromFile a.jpg -ISO -TagsFromFile b.jpg -comment dst.jpg Copy ISO from one image and Comment from another image to a destination image. exiftool -tagsfromfile src.jpg -exif:all --subifd:all dst.jpg Copy only the EXIF information from one image to another, excluding SubIFD tags. exiftool '-FileModifyDate
08ab062aa8