EPS input, PNG output: no clip path defined with 7.0.10

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Locked
axelrose
Posts: 100
Joined: 2008-12-16T06:01:27-07:00

EPS input, PNG output: no clip path defined with 7.0.10

Post by axelrose »

I have an EPS file produced by Photoshop with a single clip path saved with TIFF preview.

This works totally fine with 7.0.8:

Code: Select all

convert input.eps -alpha transparent -clip -alpha opaque -strip output.png
The resulting png has the required transparency:

Image

I cross checked clipping path with identify:

Code: Select all

identify -format '%[8BIM:1999,2998]' input.eps
<?xml version="1.0" encoding="iso-8859-1"?>
<svg xmlns="http://www.w3.org/2000/svg" width="447" height="420">
<g>
<path fill-rule="evenodd" style="fill:#000000;stroke:#000000;stroke-width:0;stroke-antialiasing:false" d="
M 130 24
C 177.197 22.9974 198.698 39.2996 224 59
C 226.333 56.6669 228.667 54.3331 231 52
C 252.311 41.6568 267.075 28.7594 297 24
C 376.672 11.3286 446.714 100.194 419 180
C 405.782 218.063 373.582 241.858 348 268
C 306.671 310.996 265.329 354.004 224 397
C 223 396.333 222 395.667 221 395
C 208.335 382.001 195.665 368.999 183 356
C 156.003 327.336 128.997 298.664 102 270
C 81.2543 247.261 53.2177 227.821 38 200
C 12.8406 154.003 26.3569 90.2257 56 60
C 80.776 34.7371 95.2957 37.9723 130 24 Z
"/>
</g>
</svg>
Now my problem is with version 7.0.10-2.

I recompiled it the same way I compiled 7.0.8 from source.
The binaries are using the same "delegates.xml", the same GhostScript, the same "policy.xml", the same "config.xml".

Still the output cannot be produced properly for the missing clip path, no matter what I tried.

Code: Select all

$ convert input.eps -alpha transparent -clip -alpha opaque -strip output.png
convert: no clip path defined 'input.eps': No such file or directory @ error/image.c/ClipImagePath/708.
$ identify -format '%[8BIM:1999,2998]' input.eps
identify: unknown image property "%[8BIM:1999,2998]" @ warning/property.c/InterpretImageProperties/4093.
Finding: if I don't have a GhostScript installation the conversion extracts the included low res TIFF preview.
Input EPS is downloadable from https://www.dropbox.com/s/2viearfd1derh ... t.eps?dl=1

Is this a bug or can I help myself with configuration?

Thanks for checking, stay safe!
Axel.

[edit 2020-04-01: broken links corrected]
Last edited by axelrose on 2020-04-02T01:31:27-07:00, edited 2 times in total.


User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by fmw42 »

Either you posted the wrong file or it got changed. There is no clipping path in the eps provided. I tested in IM 6.9.11.3 Q16 Mac OSX and identify -verbose does not show a clip path. Also the following failed in IM 6:

Code: Select all

convert input.eps -alpha transparent -clip -alpha opaque -strip output.png
convert: no clip path defined `input.eps': No such file or directory @ error/image.c/ClipImagePath/703.

Check with exiftool and see if you have a clipping path or not!

axelrose
Posts: 100
Joined: 2008-12-16T06:01:27-07:00

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by axelrose »

Sorry for this extra fuzz. I'm not really sure what happens at upload/download via Google drive.
I tried again with Dropbox, new link https://www.dropbox.com/s/2viearfd1derh ... t.eps?dl=1 and made sure it works like this:

Code: Select all

$ curl -L -o input.eps 'https://www.dropbox.com/s/2viearfd1derhqn/input.eps?dl=1'
$ shasum -a 256 input.eps
70b5ba2cc682c032da2ad4aca6408ddd3e40c4b9b61402576b2e239427ccf639  input.eps
The clipping path is fine. Checking again with 7.0.8:

Code: Select all

$ identify -verbose input.eps | grep path
  Clipping path:
<path fill-rule="evenodd" style="fill:#000000;stroke:#000000;stroke-width:0;stroke-antialiasing:false" d="
$ exiftool input.eps | grep -i path
Clipping Path Name              : Pfad 1
and still broken with 7.0.10 for me ...

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by fmw42 »

ImageMagick still does not see any clipping path even with IM 6.

Code: Select all

convert input.eps -alpha transparent -clip -alpha opaque -strip output.png
convert: no clip path defined `input.eps': No such file or directory @ error/image.c/ClipImagePath/703.

Try zipping the file before uploading.

axelrose
Posts: 100
Joined: 2008-12-16T06:01:27-07:00

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by axelrose »

Thanks for staying on the ball!!
Please try this ZIP download https://www.dropbox.com/s/5qx05zxdu78hm ... s.zip?dl=1

I added checksums and my validation procedure below in detail to avoid another round ...

Code: Select all

$ zip input.eps.zip input.eps
  adding: input.eps (deflated 85%)
$ shasum -a 256 input.eps*
70b5ba2cc682c032da2ad4aca6408ddd3e40c4b9b61402576b2e239427ccf639  input.eps
20a242750ae422cb8317ac5ab2e0360feef682a1c77f9397820105afa729cbcb  input.eps.zip

$ unzip input.eps.zip -d check
Archive:  input.eps.zip
  inflating: check/input.eps
$ shasum -a 256 check/input.eps
70b5ba2cc682c032da2ad4aca6408ddd3e40c4b9b61402576b2e239427ccf639  check/input.eps

$ curl -L https://www.dropbox.com/s/5qx05zxdu78hmpn/input.eps.zip?dl=1 -o dl.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  173k  100  173k    0     0   133k      0  0:00:01  0:00:01 --:--:--  441k
$ mkdir dl-check
$ unzip dl.zip -d dl-check
Archive:  dl.zip
  inflating: dl-check/input.eps
$ shasum -a 256 dl-check/input.eps
70b5ba2cc682c032da2ad4aca6408ddd3e40c4b9b61402576b2e239427ccf639  dl-check/input.eps

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by fmw42 »

ImageMagick still sees no clip path. There is no SVG path in the file.

Code: Select all

convert input.eps -alpha transparent -clip -alpha opaque -strip output.png
convert: no clip path defined `input.eps': No such file or directory @ error/image.c/ClipImagePath/703.

However, I opened the file in Photoshop and it does have a path. So it must be buried in some special photoshop tag.

I am not an expert on this, so I will have to leave this to the ImageMagick developers.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by fmw42 »

I opened your file in Photoshop CC and saved it as TIFF and also again as EPS. The TIFF file now contains an SVG clip path. But the EPS file that I saved again does not include an SVG clip path, at least according to identify -verbose.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by snibgo »

With the latest input.eps linked upthread, with Ghostscript 9.19, IM v6.9.9-50 shows a clipping path but IM v7.0.8-64 doesn't.

Perhaps IM v7.0.8-64 has a bug.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by fmw42 »

I was using IM 6.9.11.3 and 7.0.10.3 and GS 9.50 and it did not show.

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by magick »

The clipping path appears to be associated with the embedded TIFF image in the EPT image. Currently, we return the embedded EPS image which does not appear to include the clipping path. We changed the EPT reader to return both embedded images. You can get both with image.ept. For EPS, use image.ept[0]. To get the embedded TIFF image, use image.ept[1].

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by fmw42 »

ImageMagick 7.0.10-5 Q16

This works:

Code: Select all

magick input.eps[1] -alpha transparent -clip -alpha opaque -strip output.png

axelrose
Posts: 100
Joined: 2008-12-16T06:01:27-07:00

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by axelrose »

Thanks for your help. Still issues though

Using 7.0.10-6 this is good output:

Code: Select all

convert input.eps[1] -alpha transparent -clip -alpha opaque -strip output.png
But image geometry seems problematic:

Code: Select all

convert input.eps[1] -alpha transparent -clip -alpha opaque -units PixelsPerInch -density 72 -trim output.png
convert: geometry does not contain image `/tmp/input.eps' @ warning/attribute.c/GetImageBoundingBox/507.
Yes, the input has an embedded TIFF preview with a clipping path.
magick's answer above
Currently, we return the embedded EPS image which does not appear to include the clipping path
is interesting.

With 7.0.8 I can extract this EPS clipping path as proper SVG. I would need this since the TIFF preview is low quality only.
identify -verbose returns on
7.0.8 -> 1 path
7.0.10-2 -> no path
7.0.10-6 -> 2 paths

I'm desperate enough to check with printf debugging by patching source code. If you have some good experiments please let me know.


-- Axel.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by fmw42 »

Try putting the -strip back in our longer command. And add +repage after the -trim. For IM 7, use magick not convert.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: EPS input, PNG output: no clip path defined with 7.0.10

Post by fmw42 »

I can confirm the issue on IM 7.0.10.6 and GS 9.50

Locked