How to use Exiftool to copy jpg metadata to RAW file after exporting from Lightroom - exiftool

Using Lightroom, I made adjustments to some jpg files (primarily to the toning), as well as added some IPTC data. I saved the metadata to those files and also exported them.
Now I would like to copy just the IPTC and edit adjustments from either the sorce jpgs or the exported jpgs into their corresponding RAW files, but I'm not sure of the syntax or tags to specify.
This is my folder structure:
.\Working
.\Working\RAW_Source\
.\Working\JPG_Source\
.\Working\JPG_Exports\
Notes:
all file names are the same except for their extensions.
there are no sidecar files involved. Metadata needs to exist ONLY in the jpg
or RAW files.
Thanks

Assuming that the files have the same base name, your basic command would be along these lines.
To copy from JPG_Source to RAW_Source
exiftool -TagsFromFile .\Working\JPG_Source\%f.jpg -xmp:all -iptc:all .\Working\RAW_Source\
To copy from JPG_Exports to RAW_Source
exiftool -TagsFromFile .\Working\JPG_Exports\%f.jpg -xmp:all -iptc:all .\Working\RAW_Source\
To copy tags from either source (latter DIR has priority)
exiftool -TagsFromFile .\Working\JPG_Exports\%f.jpg -xmp:all -iptc:all -TagsFromFile .\Working\JPG_Source\%f.jpg -xmp:all -iptc:all .\Working\RAW_Source\
That will copy all XMP tags (which includes IPTC Core) and IPTC IIM/Legacy tags to the RAW files.
These commands would create backup files which can be suppressed with the -Overwrite_Original option. You can recurse into subdirectories with the -r (recurse) option.
These commands do not include any GPS tags or EXIF tags. You can add the GPS tags by adding -GPS:All to the command. It's usually not a good idea to edit tags in the EXIF group in RAW files unless you know exactly what you are doing, as it can cause the RAW file to become unviewable, as some of these tags are needed to tell software how to render the image (see ExifTool FAQ #8).
Also take note that these command write the data directly into the RAW file. If you wish to write the data into an XMP sidecar file, the command would be more complex, depending upon whether the XMP sidecar files already exists or not. If the sidecar files already exist, then you would add -ext XMP to the above commands.

Related

Copy values from one XMP tag to another XMP tag

I have a lot of images (JPG) with some metadata.
I'm interested in these three tags, for example, from one of the images:
[XMP] FlightPitchDegree : 0.734793
[XMP] FlightRollDegree : -1.024403
[XMP] FlightYawDegree : 192.286436
I need to copy these values for each image to the next tags:
Xmp.Camera.Pitch
Xmp.Camera.Roll
Xmp.Camera.Yaw
Mostly for tag editing, I'm using ExifTool, but I can't find commands for copying values between tags inside one file.
I'll be very appreciative of any recommendation.
Best,
Andriy
To copy from one tag to another you would use the redirection feature of the -TagsFromFile option. Basically it would be
exiftool "-TARGETTAG<SOURCETAG" file.xmp
You have the names of the SourceTags (FlightPitchDegree/FlightRollDegree/FlightYawDegree), you just need to figure out the exiftool names of your target tags. I can find CameraPitch/CameraYaw/CameraRoll tags on the DJI Tags page, but those are not XMP tags. The only other place I can find tags with similar names are part of the XMP-Camera group, which are not built into exiftool and you would have to download the pix4d.config file and use the -Config option to include those definitions.
exiftool -config /path/to/pix4d.config "-XMP:Pitch< FlightPitchDegree" "-XMP:Yaw<FlightYawDegree" "-XMP:Roll< FlightRollDegree" file.xmp
The -config option must be the very first option in the command in order to load the definitions.

merging PDFs with Ghostscipt ignoring outline and using pdfmark instead

I am using a Batch script to merge different PDFs in one complete file.
%gsc% -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=letter -dEPSFitPage -o %dsk%%zus%%ext% %mfd% %pth%tmp\pdfmarks
%dsk%%zus%%ext%: Path and name of final (complete) document
%mfd%: Path and name of docs to be merged (c:\test\1.pdf c:\test\2.pdf ...)
%pth%tmp = path to the pdfmarks file
Additionally, I am creating a pdfmark document inside the script which gs uses to create the bookmarks. But unfortunately, some of the docs I am merging, have already their own bookmarks and I did not yet find a solution how to ignore those. GS should only use the bookmarks inside the pdfmarks file.
How can this be done?
Firstly; you are not 'merging' PDF files when you use Ghotscript's pdfwrite device. The process is described in detail here
The important point is that the way the input file(s) are constructed has no bearing on the way the output file is constructed. If any other software you use relies on the file being constructed in a particular fashion it may not work on the output PDF file.
The -dEPSFitPage switch only has any effect when the input is an EPS file. If you want to 'fit' PostScript or PDF files then you need to use -dPDFFitPage, -dPSFitPage or just -dFitPage. However, all of these rely on you first selecting a media size, and then preventing it being altered by setting -dFIXEDMEDIA. For EPS files you would more normally use -dEPSCrop which sets the media size to the EPS declared BoundingBox.
You can prevent the PDF interpreter reading the Outlines tree (which you are calling Bookmarks) and then creating a pdfmark from it to pass to the pdfwrite device by using the -dNO_PDFMARK_OUTLINES switch which oddly isn't documented, presumably an oversight.

Extracting file names from an online data server in Matlab

I am trying to write a script that will allow me to download numerous (1000s) of data files from a data server (e.g, http://hydro1.sci.gsfc.nasa.gov/thredds/catalog/GLDAS_NOAH10SUBP_3H/2011/345/). Unfortunately, the names of the files in each directory are not formatted in a similar way (the time that they were created were appended to the end of the file name). I need to be able to specify the file name to subset the data (I have a special tool for these data types) and download it. I cannot find a function in matlab that will extract the file names.
I have looked at URLREAD, but it downloads everything including html code.
Thanks for your help!
You can easily parse the link.
x=urlread(url)
links=regexp(x,'<a href=''([^>]+)''>','tokens')
Reads every link, you have to filter all unwanted links.
For example this gets all grb files:
a=regexp(x,'<a href=''([^>]+.grb)''>','tokens')

Adding RCS Header in Binary files

I am using RCS source control and need to check in an binary file (gif image and a jar file) how do I add an $Header$ keyword so that the version information is replaced in this file during check in and get revealed when I issue "ident" command.
For text files like Java, XML etc we usually add the RCS header comments and public strings but no idea about binary files.
Basically, you don't.
Binary file formats don't typically have a way to have a variable-length chunk of arbitrary data. Even if there's a region of the file that can contain arbitrary data, the length of the expansion can vary from one checkout to another (e.g., if it goes from version 1.9 to 1.10), and that's likely to mess up the file.
For this to work, the binary format would have to tolerate a change in the size of the header string. For example, if the version number changes from 1.9 to 1.10, the RCS co command (which has no knowledge of the binary file format) will replace the string in-place, changing the offset of all data following the string. If the file format has a comment section, and that section's size is stored as a number, co isn't going to update that number.
Compiler-generated object and executable files often have RCS version information in them, but it's usually generated from the source file(s); objects and executables themselves typically aren't stored in a version control system.
Before the initial checkin of a binary file, you should run rcs -i -kb filename, so that the RCS co command doesn't attempt to do keyword replacement (just in case the file happens to accidentally contain something that looks like an RCS keyword).
If you have a binary file that you've checked out of an RCS system, and you want to know which version it is, you'll have to compare it to each of the versions in RCS. (My own get-versions might be useful for this.)
If you have a way of storing textual metadata in the file, you could also consider annotating your binary file with a timestamp. You can then correlate the timestamp with the revision by looking at the RCS log.
You mentioned Excel files. I just tried some experiments. The new .xlsx format is really a zip file; anything you put in the Comment section will be compressed, and not visible to ident. The older .xls format, at least for the small file I tried, does store the Comment section in readable text, so ident works -- but when I checked in a file, RCS expanded the Comment from "$Header:$" to "$Header: /home/kst/2012-12-06/RCS/foo.xls,v 1.1 2012-12-06 11:47:48-08 kst Exp kst $"; when I tried to open it with Excel, I got:
Excel found unreadable content in 'foo.xls'.
and it was unable to recover the contents.
In general you can't, but certain binaries has a ASCII slot to place RCS headers.
For example ZIP files
% zip -z archive.zip
$Header$
And then, after CVS handling:
% unzip -l archive.zip
$Header: /cygdrive/c/cvsroot/archive.zip,v 1.2 2020/10/14 13:46:06 omg Exp $
There are dozen of extensions extensions that are actually a zip file where you can do this: odt, pdf, ... but use carefully and prefer short RCS headers like Version or Date, because RCS don't know the slot size, and may corrupt the file.

Concatenate content of TAGS files from different directories

I'm referring to TAGS file generated by ctags or etags in order to have some code navigation in Emacs with M-..
The typical project looks like this:
Large standard library (more than 100 files, but rarely updated).
Project-specific library (updated on the daily basis).
I would like the project to be able to use two (or maybe more TAGS files), but regenerate only the portion of them, only the ones used inside the particular project. How would I approach this problem?
etags --help:
-i FILE, --include=FILE
Include a note in tag file indicating that, when searching for
a tag, one should also consult the tags file FILE after
checking the current file.