Weird behavior on EPS files

Started by ribtoks, June 11, 2019, 06:58:49 PM

Previous topic - Next topic

ribtoks

Hello

I'm trying to add keywords (for IPTC and PostScript) to vector (EPS) files. While working separately, it fails if I specify both of them.

Windows 10 x64, latest exiftool (also tried todays release)


>exiftool -IPTC:Keywords="some, keywords" -sep ", " my-file-here.eps
    1 image files updated
>exiftool -PostScript:Keywords="some, keywords" -sep ", " my-file-here.eps
    1 image files updated

>exiftool -PostScript:Keywords="some, keywords" -IPTC:Keywords="other, john" -sep ", " my-file-here.eps
Warning: Couldn't write Photoshop information - my-file-here.eps
Error: File missing %%EndData - my-file-here.eps
    0 image files updated
    1 files weren't updated due to errors

>exiftool -ver
11.50


Any thoughts?

Phil Harvey

It works for me with an EPS file I have here.  Could you send me your eps file so I can reproduce this problem?  My email is philharvey66 at gmail.com

Also, basically nothing will read IPTC from an EPS file.  You are better off to write XMP.  But I would like to track down this problem.

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

ribtoks

Quote from: Phil Harvey on June 11, 2019, 09:26:31 PM
It works for me with an EPS file I have here.  Could you send me your eps file so I can reproduce this problem?  My email is philharvey66 at gmail.com

Also, basically nothing will read IPTC from an EPS file.  You are better off to write XMP.  But I would like to track down this problem.

- Phil

I sent you an email with the file. Thanks for taking care about this problem.

Phil Harvey

ExifTool 11.50 works fine with the sample you sent:

% exiftool -IPTC:Keywords="some, keywords" -sep ", " tmp/Ice-cream_icons.eps
Warning: [minor] IFD0 BitsPerSample should have 2 values - tmp/Ice-cream_icons.eps
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - tmp/Ice-cream_icons.eps
    1 image files updated
% exiftool -PostScript:Keywords="some, keywords" -sep ", " tmp/Ice-cream_icons.eps
Warning: [minor] IFD0 BitsPerSample should have 2 values - tmp/Ice-cream_icons.eps
    1 image files updated
% exiftool -PostScript:Keywords="some, keywords" -IPTC:Keywords="other, john" -sep ", " tmp/Ice-cream_icons.eps
Warning: [minor] IFD0 BitsPerSample should have 2 values - tmp/Ice-cream_icons.eps
    1 image files updated
% exiftool tmp/Ice-cream_icons.eps -keywords -a -G1
[PostScript]    Keywords                        : some, keywords
[IPTC]          Keywords                        : other, john
% exiftool -ver
11.50


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

ribtoks

Thanks for trying. I didn't make it up - this was the actual output. Also for the 11.50 version (I repeated all steps). Don't know what else can I say.

Phil Harvey

Odd.  OK, I have run this on Windows, and can now reproduce the %%EndData problem, so I will look into this.

I don't understand why you aren't getting the warnings though, because I see these in Windows too...  unless you have a config file with IgnoreMinorErrors set.

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

Phil Harvey

OK.  The behaviour is the same on Windows and other platforms (whew!).  Here is a sequence of commands to reproduce the problem, starting from the sample file you sent:

% exiftool -postscript:keywords=y test.eps
Warning: [minor] IFD0 BitsPerSample should have 2 values - test.eps
    1 image files updated
% exiftool -postscript:keywords=y test.eps
Warning: [minor] IFD0 BitsPerSample should have 2 values - test.eps
    1 image files updated
% exiftool -postscript:keywords=y test.eps
Warning: [minor] IFD0 BitsPerSample should have 2 values - test.eps
Error: File missing %%EndData - test.eps
    0 image files updated
    1 files weren't updated due to errors


The error shows up the third time this command is executed.  I have just released ExifTool 11.51 which fixes this problem.  (Note that this prevents ExifTool from creating the file that results in the error, but it still won't write files that already have this problem.)

I have also removed the BitsPerSample warning since it seems to be common in EPS files.

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

ribtoks

The problem was originally detected on macOS. It's just I was investigating it on Windows.

Thanks a lot for your help and for quick fix!

I have a stupid question:

- what are the odds this will allow writing XMP to AdobeIllustrator-processed EPS? (I had to ask this, sorry)

Non-related questions. XMP SDK as used in exiv2 project (C++) seems to write XMP correctly to EPS so that Adobe Illustrator is capable of reading and working with the file. What is the way to force XMP writing in EPS files for exiftool? I want to experiment with this - maybe latest Adobe Illustrator is already capable of working with such files and the problem does not exist anymore?

Phil Harvey

Quote from: ribtoks on June 13, 2019, 12:11:47 PM
- what are the odds this will allow writing XMP to AdobeIllustrator-processed EPS? (I had to ask this, sorry)

Sorry, this is still not possible.

QuoteNon-related questions. XMP SDK as used in exiv2 project (C++) seems to write XMP correctly to EPS so that Adobe Illustrator is capable of reading and working with the file. What is the way to force XMP writing in EPS files for exiftool? I want to experiment with this - maybe latest Adobe Illustrator is already capable of working with such files and the problem does not exist anymore?

The problem as I remember it was that Illustrator wrote XMP in a different place in Illustrator EPS files vs regular EPS files, and it would have been some work to patch ExifTool to do this.  But if you want to provide a sample of a file before and after writing XMP with the SDK, I'll take a look at this again.

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

ribtoks

Thanks again. I've sent you the files to the same email.

Can you let me know if there's a way to force exiftool to write XMP to Illustrator-touched EPS? I also would like to experiment on my own.

Phil Harvey

Thanks for the samples.  I would be better if the original didn't already contain XMP, because the SDK just did a simple in-place XMP edit in the sample you sent.

You can write an Illustrator EPS with Exiftool by manually changing the Postscript Creator string so it doesn't start with "Adobe Illustrator" (with a byte editor or something).

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

ribtoks

Is there a way to force exiftool to modify XMP in place?

I just changed a file with XMP metadata and exiftool moved existing XMP and PostScript metadata away.

Phil Harvey

Quote from: ribtoks on June 13, 2019, 07:10:30 PM
Is there a way to force exiftool to modify XMP in place?

No.

QuoteI just changed a file with XMP metadata and exiftool moved existing XMP and PostScript metadata away.

I don't understand what you mean by this.

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

ribtoks

Quote from: Phil Harvey on June 13, 2019, 09:06:09 PM
QuoteI just changed a file with XMP metadata and exiftool moved existing XMP and PostScript metadata away.
I don't understand what you mean by this.

Sorry. What I did is the following:
- run exiftool with "-XMP:Title=xxx" on file 1.eps
- compared 1.eps and 1.eps_original in vim

in 1.eps (after being processed by exiftool) XMP packet isn't in the same place as it was.

Phil Harvey

If you are talking about the file you sent, then ExifTool would write an additional XMP packet in addition to the existing one.

In the file you sent, the XMP is attached to page 1.  ExifTool edits only document-level XMP.

I was also looking at the ExifTool source code.  ExifTool will edit XMP in place if it finds document-level XMP in an unexpected location.  I had forgotten about this.

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