Page 2 of 2

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-25T05:07:48-07:00
by dlemstra
I think I am not explaining the current situation clear enough. Your file is saved but I don't think it is saved in level 3. A co-worker of mine has illustrator which has an option to force the output format as level 3. The file now starts with 'PS-Adobe-3.1 EPSF-3.0' but ImageMagick is unable to find a clipping path. Can you check illustrator again to see if you find an option to force level 3 and supply us with a new image that does contain a clipping path?

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-25T07:00:54-07:00
by pipitas
alexm wrote:But it shows "ps:Level: Adobe-3.0 EPSF-3.0" - doesn't that mean level 3 ?
No, it doesn't.

The string "Adobe-3.0 EPSF-3.0" has to be read as two different declarations:
  1. PS-Adobe-3.0
  2. EPSF-3.0
The first of these declarations, "PS-Adobe-3.0", declares that the file creator claims that this file follows the Adobe "Document Structuring Conventions version 3.0" (DSC). These conventions have nothing to do with the PostScript language level. DSC requires a certain structure of PostScript documents, which is accompanied by certain required comment lines such as %%Title:, %%BeginProlog, %%EndProlog, %%BeginSetup, %%EndSetup. The declaration is not necessarily true. There are a lot of PS files out in the wild which were created by some applications which don't really have a clue about the meaning of the first line they used in their output file. (The PostScript language level would have to be declared in a different statement within the code, not in the first line.)

The second of these declarations, "EPSF-3.0", simply declares the file to be conforming to Adobe's version 3 of its specification document describing the Encapsulating PostScript Format (can be retrieved here: http://partners.adobe.com/public/develo ... F_Spec.pdf). This declaration also is not necessarily true... (same statement about real-world PS files as above could be repeated here).

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-25T07:08:46-07:00
by pipitas
dlemstra wrote:Can you or one of the other readers of this topic help me find a document that tells us it is allowed to write '%BeginPhotoshop' in a PostScript 3 document?.
Any line in a PostScript file starting with the '%' character indicates that this complete line is a comment and should not be interpreted by the PostScript interpreter. (If the '%' character appears later on any line, then the rest of that line is to be treated as a comment.)

Hence, to insert '%BeginPhotoshop' as a line on its own anywhere in a PostScript 3 document is perfectly "legal".

While a PostScript interpreter should ignore this line, Photoshop itself is free to treat it any way it wants and (for example) use it as a "structuring" mark for its own purposes.

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-25T07:17:56-07:00
by alexm
dlemstra wrote:I think I am not explaining the current situation clear enough. Your file is saved but I don't think it is saved in level 3. A co-worker of mine has illustrator which has an option to force the output format as level 3. The file now starts with 'PS-Adobe-3.1 EPSF-3.0' but ImageMagick is unable to find a clipping path. Can you check illustrator again to see if you find an option to force level 3 and supply us with a new image that does contain a clipping path?
We are saving it with Photoshop - there is no setting in the export dialog to specify postscript level. We choose the "Photoshop EPS" file format.

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-25T07:24:34-07:00
by pipitas
alexm wrote:@pipitas
There IS a clipping path in JPG.

No, to my knowledge, clipping paths are no part in the official JPEG file format specification.
alexm wrote:At least photoshop can store it
Yes, it is a proprietary extension of Photoshop. Only those applications which have reverse-engineered how it works can make use of it. Photoshop of course makes use of it automatically. (You luckily expressed it as "at least Photoshop can...")
alexm wrote:and it is displayed when I do a identify -verbose.
Good then. -- Does it work reliably?!?
alexm wrote:Also EPS files can have such a clipping path
That's something different here. And it is "official"...

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-25T08:00:59-07:00
by alexm
pipitas wrote:
alexm wrote:@pipitas
There IS a clipping path in JPG.

No, to my knowledge, clipping paths are no part in the official JPEG file format specification.
.
interesting.
pipitas wrote:
alexm wrote:At least photoshop can store it
Yes, it is a proprietary extension of Photoshop. Only those applications which have reverse-engineered how it works can make use of it. Photoshop of course makes use of it automatically. (You luckily expressed it as "at least Photoshop can...")
okay. I love proprietary stuff ;-(
pipitas wrote:
alexm wrote:and it is displayed when I do a identify -verbose.
Good then. -- Does it work reliably?!?
Yes that seems to work well.
Also preserving the path when converting works and when converting from EPS to JPG also. And this path can be read in photoshop ...
pipitas wrote:
alexm wrote:Also EPS files can have such a clipping path
That's something different here. And it is "official"...
[/quote]

... only when we save to EPS3 the path is lost and can not be read in photoshop or imagemagick. In dlemstra's sample file after his modification the clipping path can not be read in photoshop but in imagemagick.

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-25T08:34:43-07:00
by pipitas
alexm wrote:Did you find out how Photoshop is storing the clipping path different to ImageMagick? Can imagemagick store it the same way?
The file contains a big chunk of binary "garbage", sized 64400 Bytes, before even the magic line

Code: Select all

%!PS-Adobe-3.0 EPSF-3.0
appears.

I assume the (proprietary!) clipping path of Photoshop (if at all contained in the file) is part of this 64400 bytes of binary. Because within the PostScript code itself there is no clipping path defined (and no `clip` operator used).

The only definition resembling a clipping path are these lines:

Code: Select all

 %%BoundingBox: 0 0 240 240 
 %%HiResBoundingBox: 0 0 240 240 
Which is the magic "clipping path" you expect to be in the EPS file? Can you give its specific values as you see them in Photoshop?

(For me, trying to guess it when rendering the file in Ghostview, I'd say it should be roughly within a BoundingBox of [42 61 121 142].)

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-26T01:49:03-07:00
by alexm
Hi,

the clipping path is supposed to be around the black triangle in the picture.
I have no idea as well how it is stored - but it can't be that proprietary or - if it is - it has been implemented in imagemagick, because identify can read it!

$ identify -verbose dreieck_rgb_pfad2_photoshop.eps

[...]

Clipping path:
<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="240" height="240">
<g>
<path style="fill:#00000000;stroke:#00000000;stroke-width:0;stroke-antialiasing:false" d="
M 53,133
L 126,63
L 151,163
"/>
</g>
</svg>



So if IM can read it, it would be great if it was able to write it that way :-)

Regards,

Alex

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-03-26T07:52:49-07:00
by alexm
Hello again,

my knowledge of C++ is very bad ... but I had a look at coders/ps3.c (is that used also for eps3) ?

There is:

/*
PS clipping path from Photoshop clipping path.
*/
if ((image->read_mask != MagickFalse) ||
(LocaleNCompare("8BIM:",image->magick_filename,5) != 0))
(void) WriteBlobString(image,"/ClipImage {} def\n");
else
{
const char
*value;

value=GetImageProperty(image,image->magick_filename,exception);
if (value == (const char *) NULL)
return(MagickFalse);
(void) WriteBlobString(image,value);
(void) WriteBlobByte(image,'\n');
}

So it looks like there is some logic for storing the clipping path. But even when I convert to ps3 the clipping path is not recognized by identify.

(void) WriteBlobString(image,"/ClipImage {} def\n");

looks for my like an empty clipping path is written ?!

Is that a piece of non-implemented code?

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-04-14T03:00:22-07:00
by alexm
Is there any update on this? Is this accepted as a bug?

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-04-14T04:07:28-07:00
by dlemstra
I am still trying to figure out what that part does. But I need some documentation on how the path should be stored in a ps3 file.

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-04-14T04:18:52-07:00
by alexm
No clue where to get that kind of documentation. But the key part is, that imagemagick CAN read that path - just not write. So that should be possible to debug?

Re: Converting eps to eps3 loosing clipping path

Posted: 2015-04-14T06:15:19-07:00
by dlemstra
The file that you supplied looks like a version two document. The file I gave you earlier to test did the same in version 3 as we did in version 2 and it failed in Photoshop. Not sure how to proceed without some documentation.