Project

General

Profile

Bug #847

Photoshop doesn't recognize its own EPS files after modification by Exiv2

Added by Volker Grabsch about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Category:
image format
Target version:
Start date:
07 Sep 2012
Due date:
% Done:

100%

Estimated time:

Description

Introduction

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.

Problem

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.

Reason

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.

Associated revisions

Revision 2869 (diff)
Added by Volker Grabsch about 9 years ago

Issue #847: Add recognition of explicit and implicit BeginPageSetup

Revision 2870 (diff)
Added by Volker Grabsch about 9 years ago

Issue #847: Always insert BeginPageSetup/EndPageSetup when missing

Revision 2871 (diff)
Added by Volker Grabsch about 9 years ago

Issue #847: Split recognition of implicit Page, BeginPageSetup and EndPageSetup

Revision 2872 (diff)
Added by Volker Grabsch about 9 years ago

Issue #847: Add more test cases

Revision 2873 (diff)
Added by Volker Grabsch about 9 years ago

Issue #847: Ensure that Photoshop will always recognize modified Photoshop EPS files

For a full description of this issue, see:
http://dev.exiv2.org/issues/847

Revision 2874 (diff)
Added by Volker Grabsch about 9 years ago

Issue #847: Adjust preview tests to latest EpsImage changes

History

#1

Updated by Volker Grabsch about 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 %%Page, %%BeginPageSetup or %%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 and %%EndPageSetup:

...                                     ...
%%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.

#2

Updated by Volker Grabsch about 9 years ago

I also verified that all Photoshop EPS test files ...

test/data/eps/eps-*photoshop*.eps
test/data/eps/eps-*photoshop*.eps.delxmp
test/data/eps/eps-*photoshop*.eps.newxmp

... are opening flawlessly in Adobe Photoshop CS5 12.1 now.

#3

Updated by Robin Mills over 8 years ago

  • Status changed from Resolved to Closed

Fixed in 0.24.

Also available in: Atom PDF