Python:如何检查JPG是否有剪切路径?

问题描述 投票:0回答:1

有没有办法检查JPG文件是否有剪切路径?

我知道我可以使用 ImageMagick CLI“magick recognize -verbose”来做到这一点,但我的目标解决方案应该更容易:运行 tkinter 应用程序并且用户选择图像,Python 检查该图像是否有 1 个或多个剪切路径,并且tkinter 返回信息。

我尝试了“exifread”但没有成功,看起来它无法检查剪切路径。

这里有 2 张带有剪切路径的图像:https://github.com/pimcore/pimcore/files/4009504/images.zip

python imagemagick jpeg exif exiftool
1个回答
0
投票

如果您愿意,请在 Imagemagick 中

convert image.jpg -format '%[8BIM:1999,2998:#1]' info:

如果没有剪辑路径,您将收到一条警告消息:

convert: unknown image property "%[8BIM:1999,2998:#1]" @ warning/property.c/InterpretImageProperties/4120.

如果图像有剪辑路径,则将其返回。例如:

convert 338-55.jpg -format '%[8BIM:1999,2998:#1]' info:

<?xml version="1.0" encoding="iso-8859-1"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1830" height="1684">
<g>
<path fill-rule="evenodd" style="fill:#000000;stroke:#000000;stroke-width:0;stroke-antialiasing:false" d="
M 1265.17 120.776
C 1263.92 84.9753 1262.66 81.2068 1262.66 81.2068
C 1262.66 81.2068 1255.75 79.3225 1255.75 64.2485
C 1255.75 49.1744 1257.01 49.1744 1258.89 46.6622
C 1260.78 44.1498 1267.69 43.5217 1270.2 37.8691
C 1272.71 32.2163 1272.71 17.1422 1282.13 14.6299
C 1291.55 12.1176 1319.19 12.1181 1319.19 12.1181
C 1319.19 12.1181 1319.82 5.83676 1355.62 4.58058
C 1391.42 3.32449 1665.91 4.58058 1665.91 4.58058
C 1665.91 4.58058 1674.7 14.6299 1684.13 14.6299
C 1693.55 14.6299 1707.99 12.1176 1711.13 18.3984
C 1714.28 24.6793 1716.16 29.7039 1718.04 32.8443
C 1719.93 35.9848 1734.38 176.675 1734.38 176.675
C 1734.38 176.675 1747.57 312.97 1749.45 318.622
C 1751.33 324.275 1754.47 330.556 1751.33 338.721
C 1748.19 346.886 1752.59 352.539 1748.82 356.307
C 1745.05 360.076 1740.66 364.472 1740.66 368.241
C 1740.66 372.009 1756.36 496.998 1756.36 503.907
C 1756.36 510.816 1751.33 521.493 1748.82 527.146
C 1746.31 532.799 1723.07 601.888 1718.04 606.913
C 1713.02 611.937 1674.08 610.053 1674.08 610.053
C 1674.08 610.053 1625.08 518.353 1622.57 512.072
C 1620.06 505.791 1611.89 379.546 1611.89 379.546
C 1611.89 379.546 1589.28 378.918 1580.49 382.059
C 1571.69 385.199 1568.55 385.827 1556.62 385.827
C 1544.68 385.827 1481.25 387.083 1462.4 387.083
C 1443.56 387.083 1443.56 391.48 1441.05 387.083
C 1438.53 382.687 1441.67 380.803 1436.65 380.174
C 1431.62 379.546 1423.46 379.546 1423.46 379.546
C 1423.46 379.546 1431 494.486 1429.74 506.419
C 1428.48 518.353 1397.71 609.425 1397.71 609.425
C 1397.71 609.425 1373.84 618.218 1350.6 608.797
C 1333.01 583.674 1314.79 542.22 1310.4 534.055
C 1306 525.89 1295.32 382.687 1295.32 382.687
C 1295.32 382.687 1284.02 378.29 1282.76 368.241
C 1281.5 358.192 1265.17 120.776 1265.17 120.776
M 677.174 147.776
C 675.918 111.975 674.661 108.207 674.661 108.207
C 674.661 108.207 667.752 106.322 667.752 91.2485
C 667.752 76.1746 669.008 76.1746 670.893 73.6622
C 672.777 71.1498 673.686 65.5218 676.199 59.869
C 678.711 54.2162 678.711 39.1423 688.133 36.63
C 697.555 34.1175 725.192 34.118 725.192 34.118
C 725.192 34.118 725.82 27.8368 761.622 26.5806
C 797.425 25.3244 1067.83 19.0673 1067.83 19.0673
C 1067.83 19.0673 1074.14 29.9454 1083.56 29.9454
C 1092.98 29.9454 1115.99 29.1177 1119.13 35.3985
C 1122.28 41.6792 1124.16 46.7039 1126.04 49.8443
C 1127.93 52.9847 1133.38 154.675 1133.38 154.675
C 1133.38 154.675 1137.57 312.97 1139.45 318.622
C 1141.33 324.275 1148.62 329.727 1145.48 337.892
C 1142.34 346.057 1147.42 370.341 1143.65 374.11
C 1139.88 377.878 1134.66 376.472 1134.66 380.241
C 1134.66 384.009 1141.36 497.998 1141.36 504.907
C 1141.36 511.816 1136.33 522.493 1133.82 528.146
C 1131.31 533.799 1109.07 605.888 1104.04 610.913
C 1099.02 615.937 1060.08 614.053 1060.08 614.053
C 1060.08 614.053 1012.08 521.235 1009.57 514.954
C 1007.06 508.674 1004.7 389.06 1004.7 389.06
C 1004.7 389.06 989.201 381.848 982.41 388.257
C 970.3 399.686 955.553 397.827 943.619 397.827
C 931.685 397.827 868.218 398.079 849.402 399.083
C 833.874 399.912 841.336 396.849 838.824 392.452
C 836.311 388.056 828.674 392.803 823.649 392.175
C 818.624 391.546 810.458 391.546 810.458 391.546
C 810.458 391.546 811.483 518.406 810.227 530.339
C 808.971 542.273 775.706 618.425 775.706 618.425
C 775.706 618.425 751.838 627.218 728.597 617.797
C 711.01 592.674 692.795 551.22 688.398 543.055
C 684.001 534.89 686.323 399.687 686.323 399.687
C 686.323 399.687 675.017 395.29 673.761 385.241
C 672.505 375.192 677.174 147.776 677.174 147.776
M 531.315 355.34
C 530.776 161.057 531.855 68.7727 528.078 61.2173
C 524.3 53.662 520.523 53.1223 516.206 42.3287
C 500.016 40.7097 482.208 37.4717 482.208 37.4717
C 482.208 37.4717 485.446 30.4559 425.546 28.8369
C 345.14 28.2973 219.403 27.2178 191.882 30.9957
C 164.36 34.7733 141.155 34.2336 135.759 34.2336
C 130.362 34.2336 114.713 49.3446 105.539 49.3446
C 96.3652 49.3446 85.5724 42.8684 83.9535 50.4239
C 82.3345 57.9793 75.8588 63.9157 76.3985 90.3598
C 76.9381 115.185 72.6205 185.882 72.6205 192.358
C 72.6205 198.834 68.3039 298.134 68.8434 302.991
C 69.3831 307.848 68.3039 354.26 68.3039 354.26
C 68.3039 354.26 64.5264 358.578 66.685 367.752
C 68.8434 376.926 72.6211 396.355 72.6211 396.355
L 75.3192 420.1
C 75.3192 420.1 74.24 549.083 74.24 554.479
C 74.24 559.876 102.301 617.081 107.158 626.256
C 112.015 635.43 112.015 642.446 117.951 642.446
C 123.887 642.446 150.329 644.605 154.646 640.827
C 167.058 606.828 192.421 542.067 197.278 533.432
C 202.135 524.797 205.912 524.797 207.531 514.004
C 209.15 503.21 208.61 410.386 208.61 410.386
C 208.61 410.386 226.418 408.228 231.815 409.307
C 237.211 410.386 241.529 413.624 244.227 415.783
C 246.925 417.942 272.288 411.466 272.288 411.466
C 272.288 411.466 333.807 410.386 341.362 410.926
C 348.917 411.466 373.74 410.386 380.756 408.228
C 387.771 406.069 392.628 408.767 391.549 413.624
C 390.469 418.481 390.469 433.592 389.39 443.846
C 388.31 454.1 384.533 497.813 382.914 504.829
C 381.295 511.845 381.835 524.797 378.058 524.797
C 374.28 524.797 362.408 512.924 368.344 524.257
C 374.28 535.591 386.692 534.511 389.93 553.4
C 393.167 572.289 419.07 624.637 421.229 629.494
C 423.387 634.351 425.006 634.891 442.814 634.351
C 460.623 633.811 469.257 635.43 472.495 632.732
C 475.732 630.034 509.73 556.098 514.047 555.019
C 518.364 553.94 523.761 557.717 523.221 550.702
C 522.681 543.686 526.998 407.688 526.998 407.688
C 526.998 407.688 535.093 408.767 535.093 403.91
C 535.093 399.053 531.315 355.34 531.315 355.34
M 1677.77 1374.44
C 1685.21 1455.55 1691.91 1530.7 1694.89 1542.61
C 1697.87 1554.51 1732.1 1612.55 1738.8 1626.69
C 1745.49 1640.83 1738.8 1643.06 1753.68 1644.55
C 1768.56 1646.03 1788.65 1647.52 1795.35 1639.34
C 1802.05 1631.15 1824.37 1553.77 1824.37 1544.84
C 1824.37 1535.91 1810.98 1373.69 1810.98 1373.69
C 1810.98 1373.69 1826.61 1365.51 1824.37 1329.05
C 1820.65 1280.68 1799.07 1058.94 1797.58 1037.36
C 1796.1 1015.78 1800.56 1006.85 1795.35 1001.65
C 1790.14 996.436 1787.91 991.228 1778.24 991.228
C 1768.56 991.228 1753.68 994.204 1744.75 991.228
C 1735.82 988.251 1722.42 980.066 1715.73 980.066
C 1709.03 980.066 1405.41 980.066 1391.27 980.066
C 1377.13 980.066 1368.94 989.74 1361.5 991.972
C 1354.06 994.204 1354.06 994.204 1348.11 994.204
C 1342.15 994.204 1330.99 992.716 1330.99 997.181
C 1330.99 1001.65 1326.53 1001.65 1319.08 1011.32
C 1311.64 1020.99 1309.41 1030.66 1309.41 1030.66
C 1309.41 1030.66 1301.22 1030.66 1309.41 1047.78
C 1315.36 1084.24 1325.04 1281.43 1325.04 1299.28
C 1325.04 1317.14 1325.04 1341.7 1325.04 1353.6
C 1325.04 1365.51 1325.04 1370.72 1325.04 1383.37
C 1325.04 1396.02 1332.48 1442.9 1332.48 1462.24
C 1332.48 1481.59 1332.48 1518.79 1334.71 1526.98
C 1336.94 1535.16 1347.36 1541.86 1351.08 1556.74
C 1354.8 1571.63 1389.78 1646.03 1393.5 1649.01
C 1397.22 1651.99 1435.17 1654.22 1435.17 1650.5
C 1435.17 1646.78 1473.13 1553.77 1473.87 1547.07
C 1474.62 1540.37 1471.64 1381.88 1471.64 1381.88
C 1471.64 1381.88 1488.75 1376.67 1490.99 1382.62
C 1493.22 1388.58 1492.48 1392.3 1499.92 1390.06
C 1507.36 1387.83 1607.08 1396.76 1623.45 1390.81
C 1639.82 1384.86 1650.98 1378.16 1658.42 1378.16
C 1665.87 1378.16 1677.77 1374.44 1677.77 1374.44
M 665.037 1383.6
C 665.037 1371.7 665.037 1347.14 665.037 1329.28
C 665.037 1311.43 666.722 1182.67 664.688 1088.54
C 656.503 1071.42 657.41 1059.66 657.41 1059.66
C 657.41 1059.66 659.642 1049.99 667.084 1040.32
C 667.807 1036.8 667.799 1027.76 673.398 1026.64
C 678.997 1025.52 698.501 1023.97 698.501 1023.97
C 705.943 1021.74 720.129 1011.92 734.268 1011.92
C 748.407 1011.92 1062.03 1008.07 1068.73 1008.07
C 1075.42 1008.07 1088.82 1016.25 1097.75 1019.23
C 1106.68 1022.2 1118.56 1023.23 1128.24 1023.23
C 1137.91 1023.23 1140.14 1028.44 1145.35 1033.65
C 1150.56 1038.85 1146.1 1047.78 1147.58 1069.36
C 1149.07 1090.94 1151.75 1304.93 1159.37 1363.05
C 1161.61 1399.51 1145.98 1407.69 1145.98 1407.69
C 1145.98 1407.69 1146.33 1570.81 1146.33 1579.74
C 1146.33 1588.67 1122.05 1662.15 1115.35 1670.34
C 1108.65 1678.52 1088.56 1677.03 1073.68 1675.55
C 1058.8 1674.06 1065.49 1671.83 1058.8 1657.69
C 1052.1 1643.55 1028.08 1585.01 1018.86 1563.32
C 1009.64 1541.63 1008.56 1397.91 1008.56 1397.91
C 1008.56 1397.91 991.202 1386.52 986.863 1397.37
C 982.524 1408.22 981.982 1411.47 978.185 1410.38
C 974.389 1409.3 971.135 1407.67 965.169 1407.67
C 959.203 1407.67 952.152 1408.22 952.152 1408.22
C 952.152 1408.22 955.948 1415.81 945.644 1419.6
C 935.339 1423.4 859.95 1423.4 850.188 1421.23
C 840.425 1419.06 837.713 1418.52 835.544 1409.3
C 833.374 1400.08 840.967 1396.83 833.374 1396.28
C 825.781 1395.74 826.866 1390.86 822.527 1396.83
C 818.188 1402.79 814.391 1393.03 815.476 1420.15
C 816.561 1447.26 816.019 1539.46 814.934 1544.88
C 813.849 1550.3 776.968 1667.45 767.748 1675.58
C 766.663 1686.97 716.224 1680.46 716.224 1680.46
C 716.224 1680.46 681.512 1595.32 678.258 1594.23
C 669.58 1590.44 669.038 1588.81 668.496 1578.51
C 667.953 1568.2 665.241 1545.42 665.241 1494.99
C 665.241 1444.55 665.037 1383.6 665.037 1383.6
M 500.664 1061.16
C 499.894 1198.39 498.352 1326.37 498.352 1326.37
C 498.352 1326.37 505.289 1330.99 505.289 1349.5
C 505.289 1368 503.748 1381.88 499.894 1394.21
C 496.039 1406.55 490.642 1398.84 490.642 1416.57
C 490.642 1434.3 489.102 1537.61 489.102 1537.61
C 489.102 1537.61 445.163 1650.17 440.538 1654.03
C 423.579 1657.88 395.828 1661.74 387.348 1657.88
C 375.015 1627.04 346.493 1546.09 344.951 1543.01
C 343.409 1539.92 352.66 1404.23 344.18 1402.69
C 335.701 1401.15 341.868 1398.84 334.93 1401.15
C 327.992 1403.46 328.763 1405.78 320.284 1405.78
C 311.804 1405.78 295.616 1406.55 295.616 1406.55
C 295.616 1406.55 297.929 1401.92 287.908 1401.92
C 277.887 1401.92 227.781 1403.46 222.385 1405.78
C 216.989 1408.09 218.531 1415.03 204.655 1411.94
C 190.78 1408.86 188.467 1409.63 183.071 1407.32
C 177.675 1405.01 179.217 1402.69 169.967 1402.69
C 160.716 1402.69 156.091 1401.92 156.091 1401.92
C 156.091 1401.92 154.55 1520.65 149.924 1537.61
C 145.299 1554.57 108.298 1648.63 105.215 1654.8
C 102.131 1660.97 99.0479 1667.13 99.0479 1667.13
L 53.5673 1663.28
C 53.5673 1663.28 15.7954 1577.7 15.0245 1574.62
C 14.2536 1571.53 10.3994 1566.91 10.3994 1558.43
C 10.3994 1549.95 12.7119 1401.15 12.7119 1401.15
C 12.7119 1401.15 5.00334 1378.02 5.00334 1364.14
C 5.00334 1350.27 8.08682 1224.6 8.08682 1224.6
L 16.5661 1063.47
C 16.5661 1063.47 13.4828 1055.76 13.4828 1051.9
C 13.4828 1048.05 17.3371 1041.88 17.3371 1031.09
C 17.3371 1020.3 20.4205 1011.81 36.6085 1009.5
C 52.0257 1009.5 52.0257 1014.13 65.9011 1007.19
C 79.7764 1000.25 95.1936 996.395 113.694 996.395
C 132.195 996.395 410.474 992.54 434.371 994.853
C 445.163 997.937 448.246 1003.33 456.725 1003.33
C 465.205 1003.33 479.851 1003.33 482.164 1009.5
C 484.476 1015.67 486.789 1020.3 495.268 1021.84
C 497.581 1029.55 500.664 1061.16 500.664 1061.16
"/>
</g>
</svg>

这比解析图像上的识别详细命令更容易。

© www.soinside.com 2019 - 2024. All rights reserved.