Photoshop doesn't recognize its own EPS files after modification by Exiv2
When Photoshop opens an EPS file, it normally shows the "Rasterize EPS Format" dialog. Then, Photoshop renders the EPS image at the selected resolution, and works with that raster image.
However, when Photoshop opens an EPS file that has previously been created by Photoshop, it opens that file directly. There is no need to render the EPS image as the previous Photoshop instance wrote some internal information into the EPS file.
These "Photoshop EPS" files are very convenient, because they enable the designer to treat the EPS files essentially like PSD files: The EPS files can be reopened and edited in Photoshop as often as they wish, without having to worry about multiple import/export operations.
When such a "Photoshop EPS" file is modified by Exiv2, it is no longer recognized by Photoshop. So when opening that file in Photoshop again, it shows the "Rasterize EPS Format" dialog, and even worse, it usually pre-selects the wrong resolution. So if you don't watch out, you get back your image in a drastically reduced resolution.
Photoshop stores its internal information as EPS comment section, which looks like this:
%ImageData: 37 47 8 3 1 37 7 "beginimage" %BeginPhotoshop: 3386 % 3842494D0425000000000010000000000000000000000000000000003842494D % 043A0000000000F1000000100000000100000000000B7072696E744F75747075 % ... % 00010000012E0202000400000001000000000000000000000048000000010000 % 0048000000013842494D03FD0000000000080000000000000000 %EndPhotoshop
The interesting point is where the XMP data is stored relative to this "Photoshop section". When Photoshop writes an EPS file, it stores the XMP data after the Photoshop section. However, when Exiv2 writes an EPS file, it stores the XMP data before the Photoshop section.
This small difference is enough for Photoshop to not find its EPS section anymore.
Issue #847: Split recognition of implicit Page, BeginPageSetup and EndPageSetup
Updated by Volker Grabsch almost 9 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
The current mechanism inserts XMP always immediately before
%%EndPageSetup, which is the correct place for various reasons. So I didn't touch that.
The Photoshop comments are considered to be part of the page body, which follows immediately after
%%EndPageSetup. However, this is not enforced by Photoshop, as they don't set any
%%EndPageSetup comments. It is just the result of our current heuristics. So we can easily change that.
The current heuristics say that if there is no explicit
%%Page, it is assumed to have an empty page setup, i.e. nothing between
... ... %%BeginPageSetup %%BeginPageSetup %%EndPageSetup ----> [XMP will be inserted here] [Photoshop comments] %%EndPageSetup ... [Photoshop comments] ...
I changed those to consider all leading comments (such as the Photoshop comments) to be part of the page setup. Since XMP will be added at the end of page setup, the will lead to the desired order of comments:
... ... %%BeginPageSetup %%BeginPageSetup [Photoshop comments] [Photoshop comments] %%EndPageSetup ----> [XMP will be inserted here] ... %%EndPageSetup ...
So all in all, the only change is that some comments will be considered as part of the page setup instead of the page body. This shouldn't case any trouble. (r2873)
Note, however, that before I was able to implement this, I had to clean up the page setup recognition (r2869). Also, Exiv2 will now insert %%BeginPageSetup and %%EndPageSetup if they are missing (r2870), for the same reason it already adds other missing (empty) DSC structures.