[SOLVED] SVG path outisde the bounding box

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.
Post Reply
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

[SOLVED] SVG path outisde the bounding box

Post by kriks »

Hello,

converting a eps to PNG works for the most (without RSVG, which seems to create problems), but for some clipping path, we have strange results, comming from points in the path which are very very far from the image, so the path is overlapping itself.

here's an clip path extract :

Code: Select all

C 1962.39,184.618 2002.41,125.967 2035.52,76.6422
C 2061.7,37.6286 2084.37,4.63552 2087.24,0
C 2099.23,782848 2756.83,782848 2797.31,782848
C 2777.17,37.1273 2738.19,96.9618 2703.35,144.711
C 2668.74,192.14 2638.22,227.599 2634.31,231.336
the eps geometry :

Code: Select all

  Geometry: 3304x3058+0+0
  Base geometry: 3306x3059
notice the 782848 y-coordinate

is there a way to tell IM to not handle those points?

the pictures:
FROM : http://www.pingroom.net/117154.eps
TO : http://www.pingroom.net/117154.png

the command line :

Code: Select all

convert -density 300 in.eps -profile Photoshop5DefaultCMYK.icc -profile AdobeRGB1998.icc +clip-path '#1' -fuzz 100% -transparent white -fuzz 0% -strip -format PNG24 -compress LZW -quality 95 -type Optimize -depth 8 -trim -resize 237x195 out.png
thanks for helping
Last edited by kriks on 2009-10-27T02:32:54-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: SVG path outisde the bounding box

Post by anthony »

Not handling any point in a SVG is libel to be disastrous!

SVG and IM however can handle points that are outside the 'bounds' they are not ignored, they just don't draw anything that is 'out of scope'

However the point is so extreme I would think they you have a far more serious problem of data corruption! The strange thing is it it happened twice!!!!

The other possibility is that the value is actually a negative and was cause by a register overflow of some kind!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: SVG path outisde the bounding box

Post by kriks »

thanks for your answer,

the strange thing is that opening this eps in illustrator won't show any point outside the bounding box,
and saving it again doesn't remove the bad points...

I don't have any real solution for that
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: SVG path outisde the bounding box

Post by anthony »

Can you track the points are displayed? Their isn't many in this example so it should be easy to follow the clipping path. Does it display some point for the 'bad points'?

It seems very odd that illustrator has no problems. Either illustrator handles the values in some weird way, or the method you use to extract the path (which was not mentioned) is going haywire. Probably the latter.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: SVG path outisde the bounding box

Post by kriks »

I don't understand what you meant by "track the point".

I used identify -verbose to extract the path points, then I pasted it in a SVG file, then open it in inkscape to visualise what could be the problem, and then I saw those points.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: SVG path outisde the bounding box

Post by anthony »

I mean physically look at the image and try to note the position of the control points!!!!!

MORE information on how you extracted the original clip path, may also help.
Perhaps with an example image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: SVG path outisde the bounding box

Post by kriks »

having a look at the image in Illustrator shows no point outside the picture, I don't have any other software to test with.

the picture is here http://www.pingroom.net/117154.eps

and here the copmplete identify -verbose output

Code: Select all

  Format: PS (PostScript)
  Class: DirectClass
  Geometry: 3304x3058+0+0
  Base geometry: 3306x3059
  Resolution: 300x300
  Print size: 11.0133x10.1933
  Units: PixelsPerInch
  Type: ColorSeparation
  Base type: ColorSeparation
  Endianess: Undefined
  Colorspace: CMYK
  Depth: 16/8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Channel statistics:
    cyan:
      min: 0 (0)
      max: 54741 (0.835294)
      mean: 4476.52 (0.0683073)
      standard deviation: 9152.68 (0.139661)
      kurtosis: 9.3872
      skewness: 2.97703
    magenta:
      min: 0 (0)
      max: 60138 (0.917647)
      mean: 7222.34 (0.110206)
      standard deviation: 11321.1 (0.172749)
      kurtosis: 0.599681
      skewness: 1.3113
    yellow:
      min: 0 (0)
      max: 65535 (1)
      mean: 10697.4 (0.163232)
      standard deviation: 16025 (0.244526)
      kurtosis: -0.611424
      skewness: 1.00482
    black:
      min: 0 (0)
      max: 63736 (0.972549)
      mean: 4033.76 (0.0615513)
      standard deviation: 10947 (0.16704)
      kurtosis: 13.3816
      skewness: 3.69879
  Image statistics:
    Overall:
      min: 0 (0)
      max: 65535 (1)
      mean: 5286 (0.0806592)
      standard deviation: 11417.3 (0.174217)
      kurtosis: 4.79754
      skewness: 2.34469
  Total ink density: 306%
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: cmyk(223,223,223,0)
  Matte color: grey74
  Transparent color: black
  Page geometry: 3304x3058+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: TopLeft
  Properties:
    date:create: 2009-10-23T10:42:33+02:00
    date:modify: 2009-10-23T10:42:33+02:00
    exif:ApertureValue: 8644/1000
    exif:ShutterSpeedValue: 6644/1000
    photoshop:ColorMode: 4
    photoshop:History:
    ps:HiResBoundingBox: 793.44x734.16+0+0
    ps:Level: Adobe-3.0 EPSF-3.0
    signature: 12579ccbe339a7ab908fddb83bb70612241b35fa232abe93b8736e3a7d8e245a
    stRef:documentID: uuid:7972E984E57BDE118D1AB21E1266586A
    stRef:instanceID: uuid:FD87CB26037CDE11A074D7F007EA8682
    tiff:ColorSpace: 4294967295
    tiff:Make: Phase One
    tiff:Model: P 30
    tiff:NativeDigest: 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;52AB34FCA609749092AC34D647085768
    tiff:YCbCrPositioning: 1
    xap:CreateDate: 2009-07-29T13:53:57+08:00
    xap:CreatorTool: Adobe Photoshop CS3 Macintosh
    xap:MetadataDate: 2009-07-29T09:48:12+02:00
    xap:ModifyDate: 2009-07-29T09:48:12+02:00
    xapMM:DocumentID: uuid:8A405434047CDE11A074D7F007EA8682
    xapMM:InstanceID: uuid:FCAB2717B77DDE11943F8A200B7FB269
  Clipping path:
<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="3304" height="3058">
<g>
<path style="fill:#00000000;stroke:#00000000;stroke-width:0;stroke-antialiasing:false" d="
M 3136.77,2403.62
C 3143.25,2409.63 3143.99,2411.08 3142.97,2416.18
C 3141.95,2421.29 3140.47,2425.03 3134.92,2429.34
C 3141.38,2440.68 3142.24,2440.5 3113.45,2456.26
C 3086.01,2471.29 2381.72,2856.25 2347.08,2875.58
C 2312.27,2895 2323.42,2895.53 2301.11,2874.58
C 2298.59,2872.22 2258.06,2828.11 2200.85,2770.41
C 2159.85,2729.07 2105.27,2678.3 2043.97,2617.77
C 2040.38,2614.24 2036.78,2610.67 2033.15,2607.08
C 1996.1,2627.22 1940.67,2655.83 1909.84,2673.13
C 1868.87,2696.12 1826.39,2709.61 1795.41,2715.61
C 1764.43,2721.61 1750.94,2709.11 1735.45,2695.62
C 1719.96,2682.12 1638.51,2604.65 1608.53,2576.66
C 1578.54,2548.67 1589.54,2532.17 1599.53,2519.68
C 1609.53,2507.18 1693.97,2414.21 1717.46,2387.72
C 1736.32,2366.45 1753.56,2356.14 1772.04,2347.21
C 1651.66,2227.04 1519.44,2094.68 1385.32,1962.21
C 1245.42,1824.03 1104.26,1683.9 972.622,1554.79
C 853.465,1437.92 742.011,1328.56 647.983,1235.46
C 639.088,1226.66 629.331,1218 620.718,1209.51
C 620.297,1209.09 619.881,1208.68 619.46,1208.26
C 593.497,1234.13 559.614,1242.14 537.008,1251.45
C 514.355,1260.78 512.356,1260.12 486.372,1264.78
C 460.388,1269.45 329.8,1291.44 297.153,1296.1
C 268.074,1300.26 255.608,1295.28 233.858,1275.44
C 211.205,1254.79 172.269,1217.41 150.575,1194.65
C 132.727,1175.91 137.321,1167 163.9,1149.5
C 189.577,1132.59 200.712,1126.18 225.363,1116.18
C 250.015,1106.18 408.919,1040.71 438.235,1029.38
C 438.383,1029.33 438.526,1029.27 438.673,1029.21
C 435.695,1026.24 432.777,1023.33 429.925,1020.48
C 380.868,971.506 352.411,941.912 350.788,940.192
C 333.798,922.198 336.796,927.197 337.296,913.201
C 337.67,902.699 334.964,904.605 370.276,889.945
C 385.435,883.651 426.991,867.129 474.377,849.215
C 479.155,847.409 483.999,845.583 488.879,843.748
C 493.579,835.19 499.297,825.967 503.195,820.898
C 498.198,813.401 495.2,798.739 507.193,789.242
C 507.359,774.08 505.194,777.079 517.686,771.747
C 516.687,757.252 512.976,717.757 512.69,712.767
C 512.356,706.969 510.887,708.52 517.187,705.769
C 521.112,704.055 521.684,705.402 534.276,715.233
C 531.944,692.24 523.583,603.203 522.583,589.207
C 521.584,575.212 522.983,570.713 533.477,566.215
C 543.971,561.716 571.254,557.118 581.248,555.618
C 591.242,554.119 592.741,555.018 606.233,549.52
C 619.725,544.022 783.526,474.745 800.515,468.247
C 817.505,461.749 828.698,457.25 846.187,460.749
C 855.207,462.554 1076.02,521.222 1260.6,573.791
C 1433.6,623.06 1565.87,659.252 1583.54,665.282
C 1583.94,665.393 1584.52,665.561 1585.25,665.78
C 1594.32,656.106 1600.79,648.833 1605.9,641.652
C 1615.71,627.853 1617.96,607.72 1622.52,594.306
C 1631.01,569.314 1634.51,569.314 1649.5,557.817
C 1664.49,546.321 1669.49,539.823 1691.48,511.333
C 1713.46,482.842 1734.45,467.347 1754.44,455.351
C 1774.43,443.355 1787.92,433.358 1801.41,422.362
C 1814.9,411.365 1832.89,383.375 1842.88,368.879
C 1852.88,354.384 1863.37,325.893 1871.87,307.899
C 1880.36,289.905 1886.86,276.41 1901.85,261.414
C 1916.84,246.419 1920.34,239.921 1947.32,204.433
C 1962.39,184.618 2002.41,125.967 2035.52,76.6422
C 2061.7,37.6286 2084.37,4.63552 2087.24,0
C 2099.23,782848 2756.83,782848 2797.31,782848
C 2777.17,37.1273 2738.19,96.9618 2703.35,144.711
C 2668.74,192.14 2638.22,227.599 2634.31,231.336
C 2600.08,264.045 2556.42,299.725 2526.97,322.894
C 2475.5,363.381 2383.06,429.859 2357.57,452.352
C 2332.09,474.844 2309.1,498.837 2282.62,517.831
C 2256.13,536.824 2236.65,546.821 2212.66,574.812
C 2222.64,607.574 2229.96,639.164 2234.32,671.051
C 2235.3,678.186 2241.33,700.427 2239.19,717.822
C 2236.76,737.571 2227.34,760.508 2225.65,784.743
C 2223.37,817.535 2188.18,828.729 2174.18,839.225
C 2169.19,858.719 2169.19,858.219 2155.7,876.713
C 2142.2,895.207 2102.23,930.696 2084.24,947.19
C 2066.25,963.685 2048.26,965.684 2019.78,958.686
C 1982.8,983.178 1950.82,982.179 1932.33,969.183
C 1920.34,972.182 1905.85,971.182 1896.35,970.183
C 1886.86,969.183 1876.86,964.184 1856.88,963.185
C 1836.89,962.185 1799.91,942.692 1780.92,925.197
C 1755.94,918.699 1738.95,906.203 1711.96,875.713
C 1688.28,848.951 1702.65,827.748 1715.98,815.189
C 1661.95,816.644 1598.97,818.342 1537.75,819.996
C 1466.21,821.928 1397.48,824.711 1347.52,825.982
C 1343.73,826.078 1339.79,826.176 1335.77,826.274
C 1807.2,1232.12 3121.72,2370.35 3136.1,2383.63
C 3148.72,2395.28 3148.58,2388.86 3136.77,2403.62 Z
"/>
</g>
</svg>

  Profiles:
    Profile-8bim: 17214 bytes
    Profile-exif: 586 bytes
    Profile-iptc: 7 bytes
      unknown[2,0]:
    Profile-xmp: 15966 bytes
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 38.54MiB
  Number pixels: 9.636MiB
  Pixels per second: 74.12MiB
  User time: 0.130u
  Elapsed time: 0:01.130
  Version: ImageMagick 6.5.6-10 2009-10-15 Q16 OpenMP http://www.imagemagick.org
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: SVG path outisde the bounding box

Post by anthony »

looking at the final coordinates of each 'C' entry which is the 'pass-thur' point. It looks like their is ONE point off screen.

This point happens when the clip path goes OFF the edge for the 'arm' before returning on the other side of the arm.

Looking at the raw data from the EPS file I located the equivalent postscript commands for the clipping path, however all the values seemed to be between 0.0 and 1.0 rather than the values returned by IM, except for the value that is 'crazy'.

Here are the original lines from the EPS file...
0.593943 0.939628 0.606057 0.958807 0.616077 0.974937 c
0.624002 0.987695 0.630862 0.998484 0.631730 1.000000 c
0.635360 1.000163 0.834392 1.000163 0.846642 1.000163 c
0.840547 0.987859 0.828749 0.968292 0.818204 0.952678 c
0.807730 0.937168 0.798493 0.925573 0.797309 0.924351 c
Note that the problem is with the values that is very slightly greater than 1.0 Which due to a inverted Y axis used within postscript should translate to a value that is a negative Y value. Obviously that is not what is happening.

In otherwords you have found a BUG in ImageMagick clippath translation!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: SVG path outisde the bounding box

Post by kriks »

wow

thanks for this analysis, do you know when there will be a correction for that?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: SVG path outisde the bounding box

Post by anthony »

I'll send a note to 'magick' to look at this thread.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: SVG path outisde the bounding box

Post by magick »

We can reproduce the problem you reported and will have a patch in the next point release of ImageMagick. Thanks.
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

[SOLVED] SVG path outisde the bounding box

Post by kriks »

thanks!!!

it works like a charm with version 6.5.7-2 :D :D :D
Post Reply