Clip path problem when saving TIFF as a transparent PNG

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
cva
Posts: 13
Joined: 2014-05-18T18:35:13-07:00
Authentication code: 6789

Clip path problem when saving TIFF as a transparent PNG

Post by cva »

Hi,

I've searched the forums for a solution but cannot find one, so sorry if I am repeating a question. I would really appreciate your help to fix my problem.

ImageMagick version: ImageMagick 6.8.9-0 Q16 x64 2014-04-06
Sample file: http://www.conceiva.com/_tmp/watch.tif

I want to create a transparent PNG from the above TIFF file. In Photoshop, I can see there are clip paths and I can use the first clip path to remove the background and then save as a PNG. This works great in Photoshop.
In ImageMagick, I am trying to do the same via the ImageMagick command line. I've tries all sorts of command lines such as:

Code: Select all

convert.exe watch.tif -clip -alpha transparent +clip -channel A -negate im.png
The problem I am always seeing is the clip path is not quite right. Below are the results from Photoshop and ImageMagick (please ignore color differences; that's a separate issue that I can handle):
Photoshop output: http://www.conceiva.com/_tmp/ps.png
ImageMagick output: http://www.conceiva.com/_tmp/im.png

You can see that on the top left near the "ADJUST" text, the edge is indented in the ImageMagick PNG but not the Photoshop PNG. Also on the bottom right under the "SEARCH" text, the edge is cut off.

I have 1000s of these images that all seem to have the same clip path problem and that I need to convert into PNG. What am I doing wrong? Is there a solution?

Many thanks in advance!

Best regards,

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

Re: Clip path problem when saving TIFF as a transparent PNG

Post by fmw42 »

This seems to work better than using -clip for me. Extract the clip path as an svg file and put it into the alpha channel. I am not sure why using -clip is giving a bad outline. It may be a bug. I am using IM 6.8.9.1 Q16 Mac OSX with RSVG. The following is unix syntax. Using profiles gets better color in the PNG rather than -colorspace. PNG does not support CMYK, which is the colorspace of your tiff file.

Code: Select all

identify -format '%[8BIM:1999,2998:#1]' watch.tif > clip.svg

convert watch.tif -alpha off \
-profile /Users/fred/images/Profiles/USWebCoatedSWOP.icc \
-profile /Users/fred/images/Profiles/sRGB.icc \
clip.svg -compose copy_opacity -composite watch.png
for windows, replace the ending \ with ^
cva
Posts: 13
Joined: 2014-05-18T18:35:13-07:00
Authentication code: 6789

Re: Clip path problem when saving TIFF as a transparent PNG

Post by cva »

Many thanks for the quick reply.

Just tried it on my Windows 7 computer. I am getting this error:

Code: Select all

convert.exe: no decode delegate for this image format `clip.svg' @ error/svg.c/ReadSVGImage/2955.
I assume that means I don't have RSVG delegate support.

"convert -list format" outputs the following:

Code: Select all

      SVG  rw+   Scalable Vector Graphics (RSVG 2.40.1)
     SVGZ  rw+   Compressed Scalable Vector Graphics (RSVG 2.40.1)
"convert - list configure" outputs the following:

Code: Select all

DELEGATES      bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
I have simply installed ImageMagick from http://www.imagemagick.org/script/binar ... hp#windows. I have not installed anything else. Do I have to install other components?

Best regards,

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

Re: Clip path problem when saving TIFF as a transparent PNG

Post by fmw42 »

I do not know much about Windows. Did this line work?

Code: Select all

identify -format '%[8BIM:1999,2998:#1]' watch.tif > clip.svg
This will be a simple text file that you should be able to open in any text editor.

If it did not get created or does not look correct, then just run

Code: Select all

identify -format '%[8BIM:1999,2998:#1]' watch.tif
The svg text will go to the terminal (CMD window) and you can copy and paste it into a text file with .svg for the suffix.

If it did get created and the other command failed, then post your command line here and I will look to see if it is correct.

The fact that convert -list format shows SVG as rw+ with RSVG should indicate that you have RSVG installed and IM can find it. I have heard from others that some delegates do not show in the list from convert -list configure in Windows. So that may not be a bad indicator.

My RSVG is 2.40.2, so not much newer than yours. So I would expect that is OK.

Do you have installed the profiles that I used? You have to use your own path to them, not mine.

Check your delegates.xml file and see what command is being used for svg. Mine shows

Code: Select all

  <delegate decode="svg" command=""rsvg-convert" -o "%o" "%i""/>
  <delegate decode="svg:decode" stealth="True" command=""inkscape" "%s" --export-png="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
cva
Posts: 13
Joined: 2014-05-18T18:35:13-07:00
Authentication code: 6789

Re: Clip path problem when saving TIFF as a transparent PNG

Post by cva »

Just uninstalled ImageMagick and re-downloaded and installed the latest Windows ImageMagick binary to make sure I did not have install problems. Unfortunately, the problem still occurs.

Command line I am using is basically what you have suggested (except I just stripped off color profiles for simplicity)

Code: Select all

identify.exe -format '%[8BIM:1999,2998:#1]' watch.tif > clip.svg
- works fine. no errors. clip.svg text file created (~15KB).

Code: Select all

convert.exe watch.tif -alpha off  clip.svg -compose copy_opacity -composite watch.png
- error message produced:

Code: Select all

convert.exe: no decode delegate for this image format `clip.svg' @ error/svg.c/ReadSVGImage/2955.
Any ideas? :?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Clip path problem when saving TIFF as a transparent PNG

Post by fmw42 »

That command works fine for me, except the colors are off because you did not use profiles.

Not sure why you are getting that message. Did you check your delegates.xml file for the lines with SVG? See my last comments in the previous message.

Post the text in the clip.svg file here inside "code" using the Code button above. Perhaps it is not getting created correctly.
cva
Posts: 13
Joined: 2014-05-18T18:35:13-07:00
Authentication code: 6789

Re: Clip path problem when saving TIFF as a transparent PNG

Post by cva »

Thanks - that was a good hint.

My delegate.xml had:

Code: Select all

  <delegate decode="svg" command=""rsvg-convert" -o "%o" "%i""/>
  <!-- Remove the extra space in - -export in the line below when you want to use inkscape -->
  <!--<delegate decode="svg:decode" stealth="True" command=""inkscape" "%s" - -export-png="%s" - -export-dpi="%s" - -export-background="%s" - -export-background-opacity="%s" > "%s" 2>&1"/>-->
So, I uncommented the inkscape decode line and removed spaces in - -export:

Code: Select all

  <delegate decode="svg" command=""rsvg-convert" -o "%o" "%i""/>
  <!-- Remove the extra space in - -export in the line below when you want to use inkscape -->
  <delegate decode="svg:decode" stealth="True" command=""inkscape" "%s" --export-png="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
Next, I downloaded and installed inkscape. Added it to the PATH system variable. Now, no error message now when processing the convert command line :), but after 15 secs of processing the convert command line, ImageMagick crashes :( .

I'll double-check my installs & PATH to make sure they are OK.
cva
Posts: 13
Joined: 2014-05-18T18:35:13-07:00
Authentication code: 6789

Re: Clip path problem when saving TIFF as a transparent PNG

Post by cva »

clip.svg:

Code: Select all

'<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="1654" height="2205">
<g>
<path style="fill:#00000000;stroke:#00000000;stroke-width:0;stroke-antialiasing:false" d="
M 458.979 619.814
C 458.332 620.982 456.631 628.703 456.422 629.85
C 456.214 630.998 456.11 631.071 454.983 633.179
C 453.856 635.287 452.457 637.999 451.665 641.098
C 450.872 644.196 448.451 653.441 448.044 657.916
Y 447.637 662.392 446.313 664.739
V 422.42 688.205 421.283 688.956
C 420.146 689.706 420.834 689.873 419.301 689.623
C 417.767 689.372 401.052 683.136 396.973 682.061
C 392.893 680.986 390.817 680.236 388.052 681.112
C 385.287 681.988 383.744 682.76 382.491 684.022
C 381.239 685.285 381.897 684.93 379.601 685.4
C 377.306 685.869 376.304 685.118 373.581 687.58
C 370.858 690.042 368.27 692.495 366.684 694.143
C 365.098 695.791 341.878 720.325 339.645 722.402
C 337.413 724.478 335.41 726.658 334.252 728.547
Y 333.093 730.435 325.06 742.142
L 314.355 758.25
V 291.104 795.092 278.917 823.586
C 266.731 852.08 265.428 856.322 264.457 859.974
Y 263.486 863.626 260.899 876.511
V 256.552 894.877 256.28 899.332
C 256.009 903.787 255.394 905.979 255.801 908.535
C 256.208 911.091 257.116 912.625 258.837 915.024
C 260.558 917.424 278.452 932.917 279.203 933.564
Y 279.954 934.211 282.134 935.651
L 276.088 962.774
L 271.988 986.772
L 270.996 994.576
V 247.052 1003.39 244.6 1004.96
C 242.148 1006.52 241.523 1006.7 239.613 1010.15
C 237.703 1013.61 237.63 1015.7 237.328 1017.84
Y 237.025 1019.98 236.357 1029.69
L 234.616 1060.14
V 233.798 1099.16 235.77 1115.55
C 237.741 1131.94 237.982 1133 240.382 1136.38
C 242.781 1139.76 244.701 1141.78 247.622 1144.18
C 250.544 1146.58 264.044 1151.75 265.536 1152.03
Y 267.029 1152.31 270.993 1154.58
V 274.615 1176.45 277.777 1192
Y 280.938 1207.54 281.887 1210.02
V 259.643 1226.4 257.233 1229.03
C 254.823 1231.67 253.988 1233.36 253.414 1237.37
Y 252.84 1241.38 254.698 1249.3
V 260.189 1279.13 264.759 1291.62
C 269.329 1304.11 282.367 1335.11 298.904 1363.74
C 315.441 1392.37 324.307 1408.68 342.711 1428.91
V 361.465 1451.64 369.613 1458.3
V 373.067 1460.68 375.049 1462.37
C 377.031 1464.06 378.972 1465.96 381.226 1466.91
C 383.48 1467.86 386.588 1468.39 389.844 1467.49
Y 393.099 1466.59 404.159 1462.9
L 419.621 1458
V 439.837 1476.28 441.089 1477.5
C 442.341 1478.72 442.487 1479.32 442.852 1480.57
C 443.218 1481.82 446.003 1497.92 447.902 1502.54
C 449.801 1507.16 450.229 1507.4 451.043 1510.4
Y 451.856 1513.39 454.6 1524
L 455.748 1529.59
V 444.775 1535.15 443.022 1536.12
C 441.269 1537.09 438.911 1540.8 437.941 1546.18
C 436.971 1551.55 435.792 1553.09 436.063 1564.92
C 436.335 1576.76 439.47 1613.78 446.846 1634.98
C 454.223 1656.18 454.964 1659.66 459.69 1664.32
V 461.526 1667.17 464.061 1668.39
C 466.597 1669.61 470.081 1671.08 472.857 1671.05
C 475.632 1671.02 476.915 1670.41 478.094 1671.41
Y 479.273 1672.42 479.889 1675.12
V 482.6 1690.25 483.643 1694.59
C 484.686 1698.93 485.301 1698.64 487.284 1700.91
Y 489.267 1703.19 492.595 1705.88
V 492 1707.6 493.482 1709.52
C 494.963 1711.44 496.559 1712.52 497.143 1713.71
C 497.728 1714.89 502.549 1723.13 503.435 1725.34
Y 504.322 1727.55 505.094 1733.53
V 509.213 1759.93 509.287 1765.08
C 509.36 1770.24 513.992 1781.49 516.288 1784.54
C 518.583 1787.59 530.29 1809.76 541.338 1817.8
V 542.989 1820.54 548.947 1821.82
C 554.905 1823.1 563.21 1821.72 564.963 1822.45
C 566.715 1823.18 566.975 1823.95 567.289 1825.6
C 567.602 1827.25 570.493 1850.22 572.235 1855.1
C 573.977 1859.98 575.395 1860.84 578.38 1864.86
C 581.364 1868.87 592.955 1878.12 596.805 1880.61
C 600.655 1883.1 604.87 1884.02 606.779 1884.67
C 608.689 1885.32 654.841 1894.5 665.098 1896.57
C 675.354 1898.64 678.89 1898.57 681.583 1899.87
C 684.275 1901.16 689.304 1901.43 694.114 1901.72
Y 698.923 1902.02 740.897 1898.53
L 828.524 1896.65
L 955.436 1896.28
L 1078.21 1898.73
V 1145.48 1900.86 1150.64 1901.93
C 1155.79 1903 1162.21 1901.86 1164.98 1900.28
C 1167.76 1898.71 1169.35 1896.75 1171.78 1893.97
C 1174.22 1891.18 1179.65 1886.97 1182.33 1885.83
C 1185.01 1884.69 1188.88 1883.84 1191.08 1881.17
C 1193.27 1878.5 1195.21 1876.12 1195.91 1871.92
C 1196.61 1867.73 1199.28 1854.43 1199.65 1852.45
V 1201.46 1847.24 1201.4 1845.47
C 1201.34 1843.71 1201.1 1842.86 1201.62 1840.11
C 1202.14 1837.35 1202.76 1830.04 1204.5 1823.22
C 1206.24 1816.39 1211.11 1794.3 1214.52 1774.41
C 1217.93 1754.53 1224.62 1716.61 1224.74 1715.49
C 1224.85 1714.36 1229.59 1679.9 1230.81 1665.08
Y 1232.03 1650.27 1237.27 1599.52
V 1241.97 1554.73 1242.47 1543.38
C 1242.97 1532.03 1247.1 1481.78 1247.1 1477.35
Y 1247.1 1472.91 1247.26 1468.27
V 1254.61 1470.76 1257.48 1471.75
C 1260.34 1472.74 1268.06 1472.48 1269.84 1471.33
C 1271.63 1470.17 1277.35 1463.95 1278.74 1461.9
C 1280.14 1459.84 1280.97 1457.96 1282.12 1456.78
C 1283.28 1455.6 1298.47 1439.36 1300.31 1436.67
C 1302.14 1433.98 1303.9 1431.96 1304 1430.64
C 1304.11 1429.33 1303.27 1428.16 1301.86 1426.11
C 1300.45 1424.06 1298.12 1421.68 1297.19 1420.64
C 1296.26 1419.61 1294.19 1417.8 1293.94 1416.68
C 1293.7 1415.56 1293.31 1414.2 1294.39 1413.41
C 1295.46 1412.61 1302.41 1409.89 1303.34 1408.14
C 1304.27 1406.39 1304.92 1405.3 1305.05 1402.98
C 1305.19 1400.66 1304.86 1399.47 1305.83 1398.78
C 1306.81 1398.09 1308.11 1397.27 1308.3 1395.97
C 1308.49 1394.67 1307.58 1393.21 1308.81 1392.76
C 1310.04 1392.32 1314.42 1390.25 1315.81 1388.61
C 1317.19 1386.97 1318.09 1386.2 1318.46 1383.46
C 1318.84 1380.72 1318.57 1378.01 1319.3 1377.79
C 1320.03 1377.57 1321.48 1377.48 1321.43 1375.34
C 1321.38 1373.2 1320.44 1372.44 1321.81 1372.05
C 1323.19 1371.66 1326.62 1370.36 1328.38 1368.64
C 1330.15 1366.93 1330.7 1365.97 1330.96 1363.88
C 1331.23 1361.79 1331.05 1358.39 1331.61 1357.1
C 1332.18 1355.81 1333.09 1356.18 1333.26 1354.46
C 1333.43 1352.73 1333.08 1352.15 1333.98 1351.34
C 1334.88 1350.53 1341.28 1347.28 1341.87 1345.15
C 1342.46 1343.01 1342.87 1341.61 1342.84 1339.28
C 1342.82 1336.95 1342.15 1335.62 1342.95 1334.92
C 1343.74 1334.23 1344.04 1332.69 1344.53 1331.67
C 1345.01 1330.65 1345.23 1330.23 1346.52 1328.97
C 1347.82 1327.72 1352.33 1325.69 1353.28 1322.92
C 1354.24 1320.14 1354.54 1319.16 1354.33 1316.3
C 1354.11 1313.44 1353.49 1314.68 1354.39 1312.03
C 1355.28 1309.37 1354.98 1308.96 1356.67 1307.28
C 1358.37 1305.6 1362.7 1303.35 1363.35 1301.29
C 1364.01 1299.23 1364.06 1298.44 1363.93 1296.3
C 1363.79 1294.15 1363.39 1291.91 1363.65 1291.15
C 1363.92 1290.39 1364.64 1289.77 1364.87 1288.32
C 1365.1 1286.87 1365.04 1285.82 1365.76 1285.06
C 1366.48 1284.29 1369.96 1281.43 1370.89 1281.46
C 1371.82 1281.49 1373.72 1282.35 1376.14 1282.6
C 1378.56 1282.84 1380.33 1283.43 1383.13 1282.44
C 1385.92 1281.45 1386.93 1281.14 1387.71 1279.67
C 1388.49 1278.21 1391.04 1269.39 1392.25 1265.06
C 1393.47 1260.73 1394.1 1258.59 1395 1256.28
C 1395.91 1253.97 1395.74 1253.32 1396.25 1249.71
C 1396.76 1246.11 1397.05 1242.69 1396.4 1241.2
C 1395.75 1239.7 1394.14 1234.7 1392.12 1231.86
Y 1390.11 1229.01 1387.11 1226.82
L 1377.06 1218.38
V 1376.46 1217.66 1373.44 1215.95
C 1370.43 1214.24 1368.84 1212.94 1367.22 1210.95
C 1365.59 1208.97 1364.55 1210.64 1364.76 1207.69
C 1364.98 1204.75 1366.82 1196.47 1366.96 1195.76
C 1367.1 1195.05 1370.94 1180.43 1371.81 1173.21
Y 1372.68 1165.98 1373.38 1162.16
V 1394.4 1155.06 1397.83 1153.46
C 1401.25 1151.85 1404.44 1150.49 1407.69 1147.99
C 1410.95 1145.49 1412.83 1143.63 1414.32 1141.23
C 1415.82 1138.83 1416.2 1135.37 1416.35 1132.25
C 1416.51 1129.13 1417.7 1119.35 1417.49 1117.63
C 1417.29 1115.9 1417.58 1114.71 1416.82 1114.3
C 1416.06 1113.9 1415.16 1113.21 1415.23 1111.25
C 1415.3 1109.28 1415.77 1109.01 1416.06 1106.06
Y 1416.35 1103.12 1416.77 1092.03
V 1417.64 1078.02 1417.74 1073.29
C 1417.83 1068.56 1418.31 1053.64 1417.89 1051.4
C 1417.48 1049.17 1417.12 1046.6 1416.39 1045.49
C 1415.66 1044.39 1415.32 1043.6 1415.73 1042.21
C 1416.13 1040.83 1415.08 1040 1416.32 1039.27
C 1417.57 1038.53 1418.33 1037.8 1418.33 1035.7
C 1418.33 1033.6 1417.7 1020.64 1417.04 1017.84
C 1416.38 1015.04 1415.96 1012.09 1413.9 1009.63
C 1411.84 1007.17 1409.7 1005.99 1408.03 1004.51
Y 1406.36 1003.03 1401.27 1001.17
V 1390.09 997.491 1387.22 996.192
C 1384.35 994.894 1377.23 991.82 1375.87 991.188
C 1374.5 990.556 1374.32 990.189 1373.87 988.369
C 1373.41 986.55 1370.03 961.301 1368.52 956.416
C 1367.02 951.53 1365.61 946.893 1366.03 945.432
C 1366.45 943.971 1367.77 942.622 1368.91 941.614
C 1370.06 940.606 1389.6 926.146 1391.55 924.208
C 1393.51 922.269 1394.22 921.611 1395.99 919.442
C 1397.77 917.273 1398.58 916 1398.6 912.883
C 1398.62 909.765 1397.91 906.195 1397.82 905.101
C 1397.74 904.008 1398.98 903.573 1398.68 902.24
C 1398.39 900.908 1398.04 900.489 1397.34 898.892
C 1396.65 897.295 1397.23 896.885 1396.63 894.502
C 1396.02 892.119 1395.84 893.084 1394.92 890.505
C 1394 887.926 1392.63 879.839 1391.03 878.284
C 1389.42 876.73 1388.52 874.936 1387.21 874.347
C 1385.89 873.757 1383.88 873.766 1381.83 874.279
C 1379.78 874.791 1377.53 875.483 1376.78 874.961
C 1376.03 874.44 1373.64 871.685 1372.43 870.229
C 1371.22 868.774 1371.23 868.435 1371.13 867.282
C 1371.02 866.129 1371.29 864.976 1370.46 864.233
C 1369.63 863.49 1369.18 863.496 1369.42 862.404
C 1369.67 861.312 1370 858.842 1369.89 857.428
C 1369.77 856.013 1370.11 855.06 1369.28 853.63
C 1368.45 852.201 1366.07 851.273 1365.03 850.192
C 1363.99 849.111 1361.6 846.681 1361.33 845.564
C 1361.06 844.447 1362 843.473 1361.2 842.208
C 1360.41 840.942 1359.61 840.829 1359.8 839.297
C 1359.99 837.764 1360.57 835.009 1360.07 833.421
C 1359.57 831.832 1358.68 831.049 1357.31 829.629
C 1355.95 828.209 1352.37 826.389 1351.87 825.314
C 1351.37 824.238 1351.45 823.869 1351.29 822.342
C 1351.12 820.814 1350.98 820.209 1350.1 819.231
C 1349.21 818.252 1349.29 818.436 1349.36 816.581
C 1349.43 814.726 1349.95 812.113 1349.09 810.755
C 1348.22 809.397 1347.79 808.761 1346.41 807.885
C 1345.03 807.008 1341.91 804.923 1341.33 804.077
C 1340.74 803.231 1340.79 803.493 1340.72 801.725
C 1340.65 799.957 1340.46 799.004 1339.52 797.994
C 1338.57 796.985 1337.95 797.749 1337.84 795.863
C 1337.73 793.977 1338.1 790.825 1337.59 789.647
C 1337.07 788.468 1336.28 788.176 1334.91 786.946
C 1333.54 785.716 1330.35 784.522 1329.76 783.605
C 1329.16 782.687 1328.97 783.405 1328.88 781.719
C 1328.8 780.033 1328.97 778.593 1327.89 777.209
C 1326.82 775.826 1325.84 776.025 1325.69 774.765
C 1325.54 773.504 1326.29 770.715 1324.98 768.809
C 1323.67 766.903 1322.81 766.805 1321.22 765.801
C 1319.63 764.796 1317.67 763.73 1317.12 762.674
C 1316.56 761.619 1315.88 761.306 1315.88 760.702
C 1315.88 760.097 1316.07 759.01 1315.27 757.653
C 1314.48 756.294 1313.42 755.515 1313.01 754.823
C 1312.61 754.132 1312.57 753.855 1312.55 752.533
C 1312.54 751.211 1312.56 748.817 1311.12 747.602
C 1309.67 746.388 1308.84 745.491 1307.71 745.158
C 1306.58 744.825 1306.13 745.081 1305.61 744.241
Y 1305.08 743.4 1301.58 737.486
V 1306.43 733.515 1307.78 731.24
C 1309.13 728.964 1309.81 727.898 1309.3 725.254
Y 1308.78 722.61 1306.3 718.996
V 1301.42 711.915 1300.76 711.234
C 1300.1 710.552 1299.53 709.61 1299.49 708.405
C 1299.44 707.201 1299.12 704.281 1298.39 696.79
C 1297.67 689.299 1296.84 685.703 1294.1 681.493
C 1291.36 677.282 1290.39 676.138 1286.68 675.19
C 1282.96 674.242 1266.88 673.9 1262.86 673.481
C 1258.85 673.063 1252.37 671.516 1250.58 668.109
C 1248.8 664.701 1249.3 664.146 1249.16 659.653
C 1249.01 655.161 1248.36 638.205 1247.34 626.717
C 1246.31 615.23 1245.89 611.719 1243.48 607.269
C 1241.08 602.82 1238.31 599.941 1238.24 598.062
C 1238.17 596.183 1238.46 595.337 1237.34 587.505
C 1236.21 579.673 1232.72 546.972 1232.08 541.924
C 1231.44 536.876 1230.64 530.359 1229.59 526.609
C 1228.54 522.86 1225.82 492.94 1224.53 485.389
C 1223.24 477.839 1217.46 448.97 1216.56 443.461
C 1215.66 437.952 1211.2 414.423 1209.99 408.368
C 1208.78 402.312 1203.07 379.532 1202.02 376.022
C 1200.98 372.512 1200.07 366.67 1199.26 364.671
C 1198.46 362.673 1198.3 360.17 1198.51 358.069
C 1198.73 355.968 1199.51 350.306 1200.26 347.897
C 1201 345.488 1202.66 344.541 1202.66 342.166
C 1202.66 339.792 1200.2 327.185 1199.9 326.656
C 1199.6 326.126 1199.07 316.432 1196.89 313.34
C 1194.71 310.248 1194.16 309.881 1190.55 308.318
C 1186.95 306.755 1185.74 306.089 1182.65 305.841
C 1179.56 305.593 1154.15 305.587 1142.69 306.322
Y 1131.23 307.057 1088.65 308.295
L 1003.67 310.142
L 901.977 309.791
V 869.897 309.958 836.759 309.347
Y 795.474 308.585 751.324 307.012
V 670.838 301.995 654.662 302.661
C 638.485 303.327 618.822 303.77 608.983 306.605
C 599.144 309.44 595.284 312.259 590.962 314.745
C 586.64 317.23 585.121 317.469 582.678 320.723
C 580.235 323.978 579.202 327.821 578.518 330.674
C 577.835 333.526 577.074 336.73 576.844 338.557
Y 576.614 340.385 575.657 342.905
L 573.829 343.571
V 561.548 343.601 557.457 343.994
C 553.366 344.387 552.76 344.37 549.967 346.172
C 547.174 347.974 544.526 350.622 540.734 353.517
C 536.942 356.412 533.543 360.367 530.852 363.843
C 528.162 367.32 525.753 369.882 523.661 373.008
C 521.569 376.134 520.381 377.714 518.835 382.429
C 517.29 387.143 516.735 390.193 516.034 393.49
C 515.334 396.786 513.742 405.304 513.195 410.812
C 512.648 416.322 511.854 417.953 511.333 421.891
C 510.811 425.828 511.281 425.034 509.616 428.997
C 507.951 432.96 506.489 434.505 504.705 437.162
C 502.92 439.818 502.868 440.049 500.998 441.381
C 499.128 442.714 496.787 441.433 493.969 443.953
C 491.151 446.472 491.407 445.899 489.519 450.494
Y 487.632 455.09 487.418 459.557
V 484.549 472.044 484.318 473.701
C 484.087 475.358 485.214 474.7 483.54 476.391
C 481.867 478.082 479.945 477.638 479.253 477.86
C 478.561 478.082 473.104 477.304 468.748 480.002
C 464.392 482.701 461.514 486.545 460.335 489.218
C 459.156 491.891 456.56 495.99 454.16 504.054
C 451.76 512.117 449.24 520.222 447.942 526.064
C 446.644 531.906 442.682 552.494 441.691 567.184
C 440.7 581.875 440.746 597.68 444.436 607.11
C 448.126 616.539 449.842 614.942 452.012 616.163
Y 454.181 617.385 458.4 618.674
L 458.979 619.814 Z
"/>
</g>
</svg>
'
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Clip path problem when saving TIFF as a transparent PNG

Post by fmw42 »

I do not know if this is significant, but your file has a single quote at the start and end that mine does not have. Try removing them.
cva
Posts: 13
Joined: 2014-05-18T18:35:13-07:00
Authentication code: 6789

Re: Clip path problem when saving TIFF as a transparent PNG

Post by cva »

Single quotes certainly are significant. Without them in clip.svg, the convert command line works fine (no crash & watch.png is created). Not sure why the single quotes are there. The following command line has single quotes in the ImageMagick output (i.e. first char & last char):

Code: Select all

identify.exe -format '%[8BIM:1999,2998:#1]' watch.tif
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Clip path problem when saving TIFF as a transparent PNG

Post by dlemstra »

Under Windows you can just do this, you don't need the quotes:

Code: Select all

identify -format %[8BIM:1999,2998:#1] watch.tif > clip.svg
I was able to run the commands without Inkscape installed.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
cva
Posts: 13
Joined: 2014-05-18T18:35:13-07:00
Authentication code: 6789

Re: Clip path problem when saving TIFF as a transparent PNG

Post by cva »

You're right. Without quotes works fine and fixes the problem. Thanks!

So, I'm down to these two commands:

Code: Select all

identify.exe -format %[8BIM:1999,2998:#1] watch.tif > clip.svg
convert.exe watch.tif -alpha off clip.svg -compose copy_opacity -composite watch.png
I get a resulting watch.png - but it does not contain transparency that I am after (see original post - i.e. the negated clip path should be transparent). What I am doing wrong? :?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Clip path problem when saving TIFF as a transparent PNG

Post by fmw42 »

Nothing. My mistake. Sorry. I did not note the transparency, since your PS png output showed none when displayed in my browser, only a white background. However, when I download it and view it another tool, it does show transparency. If I correct my command it comes out looking just like using -clip.

Code: Select all

convert watch.tif \
-profile /Users/fred/images/Profiles/USWebCoatedSWOP.icc \
-profile /Users/fred/images/Profiles/sRGB.icc \
\( clip.svg -negate \) -alpha off -compose copy_opacity -composite watch4.png
It is interesting, but the clip path seems to show the same bad outline.

Code: Select all

convert clip.svg -negate clip.png
If I open your file in PS, I see several paths, but none of them match the clip path that IM sees. Perhaps PS has its paths somewhere else and IM is not accessing the same paths.

I do not know enough about PS paths to suggest what might be going on. Perhaps another user may be able to advise further.
cva
Posts: 13
Joined: 2014-05-18T18:35:13-07:00
Authentication code: 6789

Re: Clip path problem when saving TIFF as a transparent PNG

Post by cva »

Many thanks - transparency is working better now.

As you point out, the original problem still remains regarding the difference between the clip paths that Photoshop sees and what ImageMagick sees. Hopefully someone can provide some insight or alternative method.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Clip path problem when saving TIFF as a transparent PNG

Post by fmw42 »

The only other thing I can think of is to install Inkscape and have IM use that rather than RSVG.

Perhaps user snibgo can test tomorrow on his Windows platform where I think he has Inkscape. He knows more about clip paths and SVG than I do.
Post Reply