Clipping path in .svg file ignored in Processing

Hi everyone,

I’m having yet another issue with svg files in processing (though I’m making progress). My current problem is that using my .svg file in processing ignores the clipping path. The clipping path does appear in Illustrator, Inkscape, Edge, and Firefox (haven’t tested other browsers). It should keep the background just on the hand, rather than the whole box.

Thank you for any help!

  • Ryan

This is the .svg:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 720 405" style="enable-background:new 0 0 720 405;" xml:space="preserve">
<style type="text/css">
	.st0{clip-path:url(#SVGID_2_);}
	.st1{fill:#FFF7D5;}
	.st2{fill-rule:evenodd;clip-rule:evenodd;fill:#202020;}
</style>
<g id="Clipping_Path">
	<g>
		<defs>
			<path id="SVGID_1_" d="M130.279999,274.839996c2.729996-2.459991,7.410004-8.75,11.910004-14.709991l31.389999-23.199997
				L188.929993,210c0,0,5.419998-80.350006,18.479996-96.540001c5.419998-6.720001,5.509995-14.849998,6.600006-21.239998
				c1.529999-9,4.199997-14.309998,3.190002-19.07S204,62.77,201.050003,35.369999c-0.320007-2.950001-1.509995-5.6-0.889999-8
				c3.600006-14,28.649994-11.81,46,10.549999c0.880005,1.139999,7.520004,14.09,11.220001,20.349998
				c3.290009,5.57,3.220001,28.159996,3.220001,28.159996s1.170013,32.599998,1.549988,36
				c0.329987,2.889999,0.730011,14.649994,6.76001,21.070007c6.790009,7.220001,34.809998-14.130005,34.809998-14.130005
				L442,90.269997L460.880005,89.82l13.269989-1.449997l20.220001-3.309998l33.51001-6.629997
				c1,0.510002,19.159973-3.870003,34.140015,19c3.440002,1.32,20.320007-4.209999,26.51001,3.220001
				c4.246765,7.29644,3.616821,16.444557-1.590027,23.089996c-1.849976,2.489998-8.140015,6.419998-12.950012,8.830002
				c-8.820007,4.419998-18.419983,7.360001-24.799988,9.410004c-4,1.289993-13.880005,4.259995-23.719971,7.889999
				c-10.852112,4.068085-21.433594,8.824402-31.679993,14.240005c-7.369995,3.919998-28.820007,7.210007-41.779999,13.389999
				l0.390015,2c0,0,15.690002-0.360001,23.179993-2.639999c3.950012-1.199997,18.26001,7.490005,18.26001,7.490005
				c-0.450012,0.139999,2.76001,0.929993,7.130005,15.240005s3.880005,14.399994,4.670013,18.25
				c0.660004,3.190002-4.309998,6.809998-4.209991,7c0,0-9,9.169998-13.630005,10.770004l8.529999,12.460007
				c1.840179,6.343811,3.332397,12.783417,4.470001,19.290009c2.308929,5.513062,1.352478,11.853394-2.480011,16.440002
				c-5.470001,6.709991-14.76001,8.070007-25,14c-10,5.820007-33.100006,12.51001-38.730011,13.640015
				c-6,1.200012-55.690002,15.859985-70.869995,17.200012c-22.899994,2-81.899994,6.910004-81.899994,6.910004
				s-7.769989-3-15.660004-0.609985c-7,2.100006-7.600006-0.089996-17.130005,6s-23.570007,25-27.509995,28.110016
				c-0.679993,0.549988-5.399994,8-6.25,9c-2.63501,3.014709-4.882477,6.34726-6.690002,9.920013
				c1.199997,0.089996-35.759995-28.570007-46.199997-45.220001l-22.600006-37l-12.639999-25L130.279999,274.839996z"/>
		</defs>
		<clipPath id="SVGID_2_">
			<use xlink:href="#SVGID_1_"  style="overflow:visible;"/>
		</clipPath>
		<g class="st0">
			<path id="background" class="st1" d="M0,0h720v405H0V0z"/>
			<g id="camera">
				<path class="st2" d="M220.380005,373.170013L220,371l-11.470001,17c-16.910004-12.220001-32.75-25.380005-44.419998-42.559998
					c-9.490005-14-17.889999-28.850006-26.559998-43.359985c-3.149994-5.23999-5.75-10.829987-8.710007-16.190002
					c-2.25-3.950012-2.879997-7.339996,1.419998-11.079987c4.300003-3.73999,5.830002-8.160004,9.220001-11.820007
					c8.847641-9.840027,19.336777-18.068924,31-24.320007c10.270767-5.238068,17.121307-15.394867,18.130005-26.880005
					c1.766663-11.180008,2.976669-22.426666,3.630005-33.740005c0.04776-20.56604,4.241302-40.911346,12.330002-59.82
					c0.197556-0.594971,0.462616-1.165352,0.789993-1.699997c8.949997-12.220001,7.880005-27.590004,12.139999-41.060005
					c0.128174-1.357948-0.297302-2.710129-1.179993-3.75c-5.289993-7-10.880005-13.91-12.770004-22.739998
					c-1.671936-7.119564-2.818344-14.352379-3.429993-21.639999c-0.399994-5.869999,7.449997-10.4,13.440002-9.299999
					c6.33461,0.926186,12.457489,2.956995,18.089996,6c4.920425,2.4629,9.161133,6.095839,12.349991,10.579994
					c5.079224,7.52018,9.559692,15.427849,13.399994,23.649998c1.948364,5.435829,2.910126,11.175972,2.839996,16.950005
					c0.670013,13.910004,0.429993,27.860001,1.220001,41.740005c0.150696,9.107452,2.460632,18.049118,6.73999,26.089996
					c1.169037,1.244354,2.892181,1.806168,4.570007,1.490005c8.078552-2.573044,15.830597-6.076553,23.100006-10.440002
					c13.359985-9.690002,29.079987-11.309998,44.100006-15.449997c12.339996-3.389999,24.480011-7.449997,36.809998-10.879997
					c21.679993-6,43.409973-11.833336,65.190002-17.5c3.215485-0.524483,6.48288-0.655449,9.730011-0.389999
					c24.519989,0,48.169983-6,71.929993-11c14.238098-2.527069,28.611877,3.676399,36.539978,15.769997
					c2.47998,4.139999,5.909973,3,8.940002,2.129997c5.358521-1.799858,11.223145-1.300285,16.200012,1.379997
					c1.256226,0.543159,2.353882,1.396515,3.190002,2.480003c5.483398,8.832191,3.193909,20.401833-5.23999,26.480003
					c-7.282715,4.794937-15.150208,8.636261-23.409973,11.430008c-21.640015,7-43.349976,13-63.649994,24.279999
					c-10.25,5.720001-22.660004,7.490005-34.089996,11.080002c-3.429993,1.100006-6.73999,2.399994-10.130005,3.580002l0.390015,2
					c4.5-0.389999,8.950012-0.669998,13.399994-1.179993c3.269989-0.350006,6.51001-1.100006,9.779999-1.460007
					c10.375031-0.528534,19.831696,5.919006,23.130005,15.770004c2.679993,7.490005,4.5,15.25,6.579987,22.929993
					c0.99649,3.102936-0.172333,6.491364-2.869995,8.320007c-1.540009,1.259995-2.48999,3.229996-3.940002,4.529999
					c-2.089996,1.860001-4.459991,3.470001-6.73999,5.130005c-1.269684,0.776031-2.585449,1.473984-3.940002,2.089996
					c3.165192,4.035278,6.061462,8.274429,8.670013,12.690002c1.521912,3.539108,2.580658,7.259842,3.149994,11.070007
					c0.630005,2.880005,0.589996,5.950012,1.380005,8.790009c2.528198,8.07724-1.111542,16.803314-8.630005,20.690002
					c-12.380005,5.910004-24.790009,11.820007-37.519989,17c-7.649994,3-16.079987,3.940002-23.850006,6.820007
					c-21.483063,7.089874-43.523926,12.361786-65.889984,15.76001c-9.820007,1.809998-19.910004,2.399994-29.920013,3.230011
					c-16.630005,1.339996-33.220001,2.450012-49.850006,3.630005c-2.001556,0.419952-4.068451,0.419952-6.070007,0
					c-7-2.559998-13.559998,0-20.220001,1.179993c-10.520004,1.890015-16,10.600006-22.660004,17.5
					c-5.639999,5.950012-10.720001,12.609985-16,19.190002L220.380005,373.170013z M320.089996,290.410004
					c-0.190002,0.470001-0.369995,0.940002-0.549988,1.420013c-2.720001-0.480011-5.440002-0.869995-8.160004-1.5
					c-9.859985-2.369995-17.420013-7.170013-20.649994-17.660004c-3.111145-8.996246-5.020996-18.363831-5.679993-27.860001
					c-0.589996-14.229996-4.529999-28.300003-6.269989-42.529999c-1.929993-15.759995-8.429993-30.149994-13.23999-45
					c-0.541779-1.638412-1.309143-3.193344-2.279999-4.619995c-2.799988-4.25-5.880005-8.350006-8.600006-12.690002
					c-3.149994-5-5.910004-10.319992-9.059998-15.410004c-3.838852-6.45166-4.520187-14.303535-1.850006-21.32
					c2.240005,5.600006,4.486664,11.196671,6.740005,16.790001l1.529999-0.43V117
					c0.830002-12.849998,1.660004-25.699997,2.410004-38.589996c0.469955-2.461098,0.469955-4.988899,0-7.449997
					c-5.600006-15.760002-13-30.379997-26.130005-41.689999c-5.294968-4.723116-12.408493-6.861197-19.430008-5.84
					c-3,0.32-4.649994,1.42-4.690002,5.049999c-0.275162,14.200035,4.658768,28.00935,13.869995,38.819996
					c1.443634,1.363304,3.060944,2.530052,4.809998,3.470001c-1.693192,1.852188-3.029022,4.001709-3.940002,6.339996
					c-2,9.5-3.270004,19.160004-5,28.729996c-0.669998,3.940002-1.690002,7.489998-2.600006,11.239998
					c-0.650711-0.69091-0.980942-1.623566-0.910004-2.57c0.043488-0.655052-0.048416-1.312035-0.270004-1.93
					c-7.880005,16.999992-15.449997,33.999992-15.330002,53.249992c0,10.639999-1,21.320007-1.699997,32
					c-0.509995,6.899994-2.130005,13.789993-2,20.610001c0.239502,4.30098-1.169495,8.531509-3.940002,11.830002
					c-2.715302,3.48465-6.038864,6.449097-9.809998,8.75c-17.619995,9.809998-31.529999,23.639984-46,38.269989
					C151.600006,315,170,354,206.350006,378.220001L250,330.529999h7.890015c-7.889999-7.089996-17-10.920013-22.190002-19.230011
					c6.419998,1.48999,9.259995,8.630005,16.270004,10.130005c-5.259995-5.433319-10.526657-10.860016-15.800003-16.279999
					l0.710007-0.709991l13.680008,12.179993c-1.309998-14.390015-10.449997-24.23999-18.330002-35l1.539993-1l24.589996,35.830017
					l-1.299988,0.899994c-1.429993-1.690002-2.869995-3.380005-4.300003-5.079987
					c1.448212,6.019196,4.878799,11.376373,9.740005,15.209991c1.074127,0.502502,2.315887,0.502502,3.390015,0
					c18.720001-9.929993,39.410004-13.51001,59.790009-17.26001c6.5-1.220001,13.079987-2.049988,20.329987-3.109985
					c-4.329987-13.25-15.529999-20.649994-21.160004-31.929993c10.206207,9.334412,19.92569,19.187408,29.119995,29.519989
					c1.523834,2.048035,4.058868,3.080505,6.579987,2.679993c8.160004-0.51001,16.320007-0.899994,24.480011-1.380005
					l22.899994-1.529999c-2.160004-6.566681-4.31665-13.136658-6.470001-19.709991l-49.5-9.579987l8.399994,17.350006
					l-1.380005,0.700012c-1.23999-2.119995-2.470001-4.25-3.709991-6.380005
					c-3.579987-6.149994-5.399994-13.480011-12.209991-17.420013c-1.242004-0.969635-2.310516-2.142944-3.160004-3.470001
					c-2.160004-2.600006-5.519989-5-6.070007-7.880005c-0.332458-3.856995,0.321381-7.735184,1.899994-11.270004
					c1.668579-3.754501,3.617401-7.378067,5.829987-10.839996c-1.935699-1.58609-3.766235-3.296356-5.480011-5.119995
					c-1.384247-1.453125-2.279358-3.302795-2.559998-5.289993c-0.049744-4.409882,0.399811-8.811218,1.339996-13.119995
					c0.466492-2.678574,1.86142-5.1073,3.940002-6.860001c5.640015-3.429993,11.820007-6,17.420013-8.789993
					C352.47998,186.590012,348.73999,176.360001,345,166.100006l1.609985-0.630005
					c3.940002,10.570007,7.880005,21.130005,12.100006,31.929993c4.162781-0.685043,8.35849-1.152344,12.570007-1.399994
					c2.400787,0.214905,4.527588-1.541824,4.769989-3.940002c3.51001-18.330002,15.769989-29.720001,30.589996-39.139999
					c1.555176-1.289856,2.365234-3.269958,2.160004-5.279999c-0.76886-1.981262-2.148926-3.666061-3.940002-4.809998
					c-1.895874-1.163345-3.906464-2.128448-6-2.880005l0.630005-1.300003c3.516693,1.338501,6.90683,2.988373,10.130005,4.929993
					c2.113861,1.999054,5.394012,2.085251,7.609985,0.199997c1.677704-1.736954,3.542358-3.28302,5.559998-4.610001
					c5.371704-2.48793,10.900116-4.622467,16.549988-6.389999c6.73999-2.130005,13.709991-3.550003,20.529999-5.519997
					c28.059998-8.120003,56.089996-16.349998,84.149994-24.43c5.51001-1.620003,11.190002-2.839996,17.099976-4.300003
					C551.669983,83.93,537.440002,78.18,521.679993,82c-4.809998,1.18-9.539978,2.870003-14.350006,3.940002
					c-6.579987,1.419998-13.23999,2.440002-19.700012,3.620003c-11.94931,2.618233-24.025208,4.620872-36.179993,6
					c-8.395386,0.43943-16.712891,1.838539-24.790009,4.169998c-8.345062,3.004639-16.928864,5.299454-25.659973,6.859993
					c-18.233856,2.402527-36.014587,7.476952-52.769989,15.059998c-1.109985,0.470001-2.130005,1.099998-3.190002,1.650002
					c0.100006,0.470001,0.209991,1,0.309998,1.419998c15.369995-5,30-2.480003,44.26001,3.43
					c-0.496002,0.491943-1.20752,0.69899-1.890015,0.550003c-0.632324-0.049759-1.243134-0.252213-1.779999-0.589996
					c-6.809998-4.849998-14.380005-3.150002-21.829987-2.480003c-11.820007,1.059998-23.649994,2.599998-35.470001,2.719994
					c-4.624542-0.038574-9.195923,0.98793-13.359985,3c-2.34967,1.489655-4.517639,3.248199-6.459991,5.240005
					c0.190002,1,0.390015,2,0.589996,3L290,141.630005c13.480011,4.850006,20.179993,11.270004,18,18.679993
					c-7.880005-11.080002-19.160004-12.339996-31.220001-11.820007l3.429993,1.529999
					c-0.100006,0.330002-0.209991,0.660004-0.309998,1l-9.660004-1.699997c0.116608,0.584412,0.329529,1.145386,0.630005,1.660004
					c3.312531,3.987305,6.827118,7.802307,10.529999,11.430008c9.721008,8.585037,15.889832,20.487656,17.299988,33.380005
					c0.390472,9.07486-0.470947,18.160248-2.559998,27c-1.299988,7.520004-4.579987,14.740005-5.519989,22.229996
					c-2.329987,18.000015,1.850006,32.550003,20.450012,40.469986c3.10321,1.447449,6.109497,3.094208,9,4.929993
					L320.089996,290.410004z M426.5,186.830002c-0.140015-0.720001-0.290009-1.440002-0.429993-2.160004
					c1.609985-0.75,3.230011-1.419998,4.799988-2.25c1.016541-0.581329,1.980225-1.250549,2.880005-2
					c2.049988-1.619995,3.940002-4.179993,6.190002-4.850006c9.619995-2.720001,19.350006-5.199997,29.119995-7.169998
					c10.937469-1.999512,21.433441-5.92366,31-11.589996c6.76123-4.309341,13.937012-7.930756,21.419983-10.809998
					c9.539978-3.389999,19.710022-5.320007,29.440002-7.880005c11.159973-3.070007,22.549988-5.669998,31.530029-13.559998
					c6-5.160004,5.719971-11.470001,0.590027-21.400002c-1.650024-3.190002-8.549988-3.940002-14.219971-2.239998
					c-11.830017,3.150002-23.650024,5.910004-35.469971,8.75c-6.22998,1.529999-12.619995,2.519997-18.719971,4.370003
					c-3.75,1.139999-7,3.940002-10.730011,5c-8.139984,2.840004-16.363342,5.470001-24.670013,7.889999
					c-12.690002,3.540001-25.609985,6.420006-38.149994,10.400002C433.701202,139.722473,426.626678,142.967743,420,147
					c-3.560394,2.534012-6.47821,5.866226-8.519989,9.729996c-1.179993,1.929993-0.549988,5-0.75,7.490005h-0.899994
					c-1.006683-2.800003-2.006683-5.596664-3-8.389999c-2.679993,1.850006-5.399994,3.940002-8.309998,5.589996
					c-9.962311,5.979813-17.266144,15.537033-20.420013,26.720001c-2,5.919998-0.790009,8.080002,5.640015,7.889999
					c11.820007-0.199997,23.649994-0.75,35.470001-1.580002s23.649994-2.289993,35.470001-3.229996
					c1.339996,0,2.76001,1.339996,4.179993,2.050003c-1.140472,1.475525-2.464478,2.79953-3.940002,3.940002
					c-1.5,0.910004-3.589996,0.75-5.209991,1.5c-5.589996,2.639999-10.600006,6.699997-17.339996,6.539993
					c-3.269989,0-6.540009,1-9.769989,1c-12.380005,0-24.75-0.509995-37.130005-0.860001
					c-3.940002,0-7.880005-0.360001-11.579987-0.559998c1.067352,1.620148,2.494446,2.971939,4.170013,3.949997
					c1.671478,0.833542,3.211304,1.908386,4.570007,3.190002c1.899994,2.360001-0.269989,16.119995-2.399994,18.440002
					s-3.630005,4.339996-5.790009,6.940002c1.649994,0.429993,2.359985,0.710007,3.149994,0.830002
					c24.184509,2.928955,48.6427,2.781113,72.790009-0.440002c17.389679-1.889526,34.036163-8.075256,48.440002-18
					c2.329987-1.610001,4.26001-2.949997,3.269989-6.380005c-1.420013-4.809998-2.480011-9.779999-3.540009-14.699997
					c-0.848175-5.853607-4.755798-10.809601-10.25-13c-5.359985-2.089996-11-3.660004-16.480011-5.279999
					c-0.779999-0.240005-1.769989,0.509995-2.720001,0.669998c-6.660004,1.059998-13.320007,2.210007-20,3.070007
					c-7.290009,1.110001-15.290009-3.419998-22.73999,2.639999L426.5,186.830002z M485.619995,274.48999l0.470001,0.549988
					c-0.943207,0.782715-2.006989,1.407471-3.149994,1.850006c-7.329987,1.100006-14.660004,2.25-22,3
					c-11.079987,1.190002-22.149994,2-33.230011,3.079987c-6.579987,0.630005-13.160004,1.459991-19.700012,2.170013
					c-1.263733,7.692963,2.594116,15.319733,9.540009,18.860016c7.68219,3.357513,16.649902,0.143188,20.450012-7.329987
					c1.217834,2.69812,4.392365,3.898163,7.090485,2.680328c0.737854-0.333069,1.390717-0.828918,1.909515-1.450348
					c-1.730011-4.690002-3.420013-9.230011-5.079987-13.799988l1.619995-0.790009
					c2.280029,4.41333,4.563354,8.816681,6.850006,13.209991l12.579987-7.609985l-1.190002-3.269989
					c2.410004,0,5.089996,0.869995,6.350006,0c6.339996-4.850006,13.75-5,21.079987-5.480011
					c2.48999,0,3.950012-0.940002,4.179993-3.309998c2.76001-15.76001,1.73999-23.649994-10.799988-34.600006
					c-1.75705-0.990967-3.636383-1.747406-5.589996-2.25c-9.631653,3.721222-19.976959,5.228409-30.269989,4.410004
					c-5-0.190002-10.089996-0.270004-15.100006,0c-19.470001,0.669998-38.940002,2.610001-58.169983-2.399994
					c-1.305695-0.20018-2.634308-0.20018-3.940002,0c0.056641,0.375046,0.150421,0.74353,0.279999,1.100006
					c0.38855,0.468887,0.851349,0.870895,1.369995,1.190002c5.062225,1.460861,7.98172,6.748856,6.520844,11.811096
					c-0.137299,0.475769-0.311432,0.940155-0.520844,1.388916c-0.198212,1.078461-0.291962,2.173523-0.279999,3.269989
					c-1,6.109985-2.880005,8.399994-8.910004,8.910004s-11.540009,0-17.339996,0
					c4.140961,2.294159,8.670441,3.802856,13.359985,4.449982c5.089996,0.630005,10.329987-0.309998,15.369995,0.320007
					c9.899994,1.220001,19.709991,3.109985,29.600006,4.649994c4.125763,1.402161,8.607056-0.805756,10.009216-4.931519
					c0.096741-0.284668,0.177124-0.574615,0.240784-0.868469c1.081451-3.287506,1.871185-6.663879,2.359985-10.089996
					c0.589996-3.940002,0.709991-8.229996,1-12.330002H424c0.429993,8.830002,1,17.689987-4.5,25.729996
					c-0.490753,1.034515-0.808319,2.142578-0.940002,3.279999c0.941711,0.390045,1.935699,0.639374,2.950012,0.73999
					c5,0,10.049988-0.390015,15.059998-0.670013c9.850006-0.549988,19.709991-0.73999,29.600006-1.769989
					c6.426361-0.85672,12.804718-2.041595,19.110016-3.549988L485.619995,274.48999z M334.279999,224.669998
					c3.540009,2.559998,7,5.080002,10.440002,7.490005c7.609985,5.240005,16.51001,4.490005,25,4.770004
					c5,0,11.51001-9.5,11.820007-15.569992c0.122864-5.363266-3.12204-10.230606-8.119995-12.179993
					c-11.309998-6-22.619995-2.360001-34-1.059998c-1.179993,0-2.720001,2.440002-3.109985,3.940002
					c-0.910004,4-1.339996,8.080002-2.049988,12.610001L334.279999,224.669998z M362.279999,267.820007
					c8.51001-1,8.630005-1.100006,10.839996-9.100006c0.635071-1.424957,0.955688-2.970016,0.940002-4.529999
					c-0.670013-2.720001-1.26001-6.470001-3.190002-7.690002c-4.118958-2.441757-8.582428-4.248718-13.23999-5.360001
					c-3.119995-0.820007-6.619995,0-9.850006-0.710007c-3.594879-1.160751-7.450073,0.812485-8.61084,4.407364
					c-0.009949,0.030807-0.019653,0.061691-0.029175,0.092636c-3.149994,8.470001-2.720001,14,1.190002,16.589996
					c0.411011,0.212646,0.848022,0.370636,1.299988,0.470001L362.279999,267.820007z M348.170013,203.070007l16.320007-1
					c-3.390015-2.289993-9-2-16.360016,1H348.170013z"/>
			</g>
		</g>
	</g>
</g>
</svg>

Hi @strfry – you say “this is the .svg” – and it seems like you are using the svg “clipPath” feature and hoping it works in Processing.

I believe however that the console will give you an “ignoring tag” warning, because it isn’t supported in the parser. Here is in the source code you can see the list of everything that is supported:

…and because clipPath isn’t in there, it gets a general warning:

What is the code in Processing that you are using, and what effect are you trying to create? For example, if what you want is a cropped render of the svg, you might be able to use a PGraphics and/or a mask. You could parse the clipPath data separately and generate a mask directly from that. Or you could pre-render the SVG using another tool.

1 Like