Hello
first, thanks for this tool exiftool.
I work with Epub files using Calibre http://en.wikipedia.org/wiki/Calibre_(software) and when I export, 3 files are created
-epub file
-the picture / the cover
-opf file = metadata
I d like to retrieve the infos #title/creator/date/description# from opf files//xml to write them in the iptc of the corresponding pictures.
Is it possible ?
Thanks for the reply
Arnauld
Hi Arnauld,
I've never seen an opf file, but my guess is that you would need to do some custom scripting to parse it.
- Phil
hi Phil
here is one of my opf file, if you have time to have a look http://cjoint.com/?DEzv5RY96Xp
The data to retrieve as shown in the attached doc is
Quote<dc:title>
<dc:creator>
<dc:date>
<dc:description>
When you say I need to do some scripting to parse it, well, I have no idea of what kind of scripting you are talking about...
Arnauld
Hi Arnauld,
The OPF file is XML-based, so ExifTool will read it. So the command you want is something like this:
exiftool -tagsfromfile NAME.opf "-description<PackageMetadataDescription" NAME.jpg
Here I have written the value to XMP:Description even though you said IPTC. If you really want to write it to IPTC, use "Caption-Abstract" instead.
- Phil
hi Phil
thanks for your reply and advice and exiftool. If anybody is interested, here is a link for the solution, the problem was solved with the advice you gave me
exiftool -codedcharacterset=utf8 -tagsfromfile Des_âmes_noires.opf "-Caption-Abstract<PackageMetadataDescription" Des_âmes_noires.jpg
exiftool -codedcharacterset=utf8 -tagsfromfile Des_âmes_noires.opf "-ObjectName<PackageMetadataTitle" Des_âmes_noires.jpg
exiftool -codedcharacterset=utf8 -tagsfromfile Des_âmes_noires.opf "-By-line<PackageMetadataCreator" Des_âmes_noires.jpg
from http://www.clubdeslecteurs.org/showthread.php?tid=15737
Arnauld,
Just a heads up: ExifTool 9.63 will have the ability to read EPUB files, and will extract these values from the contained OPF file without the "PackageMetadata" prefix on the tag names.
- Phil
Hi Phil,
I can not retrieve the values contained in the epub file
exiftool -codedcharacterset=utf8 -tagsfromfile Camilla_Lackberg_La_Sirene.epub "-Description" Camilla_Lackberg_La_Sirene.jpg
Warning: Unrecognized MIMEType - Camilla_Lackberg_La_Sirene.epub
Warning: No writable tags set from Camilla_Lackberg_La_Sirene.epub
1 image files updated
What is the solution?
Thanks for the reply
Your EPUB is different from all my samples, and it appears that the MIME type embedded in the file is not "application/epub+zip" as expected.
If you can mail me the file, I will take a look (philharvey66 at gmail.com)
- Phil
I just sent the message :)
thank you.
I got the file. ExifTool 9.63 extracts the Description from this file without any problem. I think you may be still using an old version of ExifTool.
- Phil
"exiftool-ver" command returns me well version 9.63.
exiftool -codedcharacterset=utf8 -tagsfromfile Camilla_Lackberg_La_Sirene.epub "-Creator" Camilla_Lackberg_La_Sirene.jpg
Warning: [minor] Error 3 placing :manifestItemHref in structure or list - Camilla_Lackberg_La_Sirene.epub
1 image files updated
In exiftool GUI, XMP has been modified but not the IPTC format.
How to write the IPTC format from an Epub file ?
exiftool -g Camilla_lackberg_La_Sirene.jpg
---- ExifTool ----
ExifTool Version Number : 9.63
---- File ----
File Name : Camilla_Lackberg_La_Sirene.jpg
Directory: .
File Size : 56 kB
File Modification Date/Time : 2014:06:09 16:02:59+02:00
File Access Date/Time : 2014:06:09 16:02:59+02:00
File Creation Date/Time : 2014:06:09 16:02:59+02:00
File Permissions : rw-rw-rw-
File Type : JPEG
MIME Type: image/jpeg
Current IPTC Digest : 2b3df19b0c67788262a0d0dced3b6d58
Image Width : 600
Image Height : 993
Encoding Process: Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components: 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
---- JFIF ----
JFIF Version : 1.01
Resolution Unit : inches
X Resolution : 105
Y Resolution : 105
---- IPTC ----
Coded Character Set : UTF8
Envelope Record Version : 4
---- XMP ----
XMP Toolkit : Image::ExifTool 9.63
Creator : Camilla Lackberg
You can copy an source tag to any destination you want. See the -tagsFromFile option in the application documentation (https://exiftool.org/exiftool_pod.html) for details.
- Phil
Before the latest version, I used the following commands :
exiftool -codedcharacterset=utf8 -tagsfromfile Des_ames_noires.opf "-Caption-Abstract<PackageMetadataDescription" Des_ames_noires.jpg
exiftool -codedcharacterset=utf8 -tagsfromfile Des_ames_noires.opf "-ObjectName<PackageMetadataTitle" Des_ames_noires.jpg
exiftool -codedcharacterset=utf8 -tagsfromfile Des_ames_noires.opf "-By-line<PackageMetadataCreator" Des_ames_noires.jpg
I can not understand that we could spent the OPF file with the new version that was able to read the tags directly from the epub file.
If I want to run commands on a folder, what command should I use?
exiftool-r-DIR?
Quote from: esoxlucius2004 on June 09, 2014, 10:39:56 AM
Before the latest version, I used the following commands :
exiftool -codedcharacterset=utf8 -tagsfromfile Des_ames_noires.opf "-Caption-Abstract<PackageMetadataDescription" Des_ames_noires.jpg
exiftool -codedcharacterset=utf8 -tagsfromfile Des_ames_noires.opf "-ObjectName<PackageMetadataTitle" Des_ames_noires.jpg
exiftool -codedcharacterset=utf8 -tagsfromfile Des_ames_noires.opf "-By-line<PackageMetadataCreator" Des_ames_noires.jpg
Combining this into a single command, with the current version the command would be:
exiftool -codedcharacterset=utf8 -tagsfromfile Des_ames_noires.epub "-Caption-Abstract<Description" "-ObjectName<Title" "-By-line<Creator" Des_ames_noires.jpgQuoteIf I want to run commands on a folder, what command should I use?
exiftool-r-DIR?
The above command would change to this:
exiftool -codedcharacterset=utf8 -tagsfromfile %d%f.epub "-Caption-Abstract<Description" "-ObjectName<Title" "-By-line<Creator" -r -ext jpg DIRwhere DIR is the name of the directory containing the EPUB and same-named JPEG files.
- Phil
Thank you for your good advice.
It works !
Hi Phil,
Is it possible to extract the image of an Epub file with ExifTool ?
In principle, the coverage file is located in the opf file).
Thanks
No. You can just use unzip if you want to extract image files from an EPUB, if that is what you are asking.
- Phil
Too bad.
In a future version ?
This would be the same as trying to extract all embedded images from a PDF document. A bit overwhelming I think. EPUB files may contain a very large number of images.
- Phil