<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>inkscape &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/inkscape/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Thu, 12 Mar 2026 09:24:11 +0000</lastBuildDate>
	<language>en-GB</language>
	<copyright>© Terence Eden. 🄯 CC BY-SA. See https://shkspr.mobi/blog/copyright-and-copyleft/</copyright>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>inkscape &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Inkscape - cropping SVG files on the Command Line]]></title>
		<link>https://shkspr.mobi/blog/2013/03/inkscape-cropping-svg-files-on-the-command-line/</link>
					<comments>https://shkspr.mobi/blog/2013/03/inkscape-cropping-svg-files-on-the-command-line/#comments</comments>
				<dc:creator><![CDATA[Terence Eden]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 14:04:38 +0000</pubDate>
		<category><![CDATA[inkscape]]></category><category><![CDATA[linux]]></category><category><![CDATA[svg]]></category>		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=7783</guid>

					<description><![CDATA[A little post as an aide-mémoire.  I&#039;ve found a lovely set of SVG playing cards.  The only problem is each image is displayed within a page.  This means the relatively small cards have an enormous white margin.  Within Inkscape (the vector image editor for Linux) it&#039;s possible to crop the margins by going to:  &#34;File → Document Properties → Resize Page To Content → Resize page to Drawing or Select…]]></description>
										<content:encoded>&lt;p&gt;A little post as an &lt;em&gt;aide-mémoire&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I've found a lovely set of &lt;a href="http://code.google.com/p/vectorized-playing-cards/"&gt;SVG playing cards&lt;/a&gt;.  The only problem is each image is displayed within a page.  This means the relatively small cards have an enormous white margin.&lt;/p&gt;

&lt;p&gt;Within &lt;a href="http://inkscape.org/"&gt;Inkscape&lt;/a&gt; (the vector image editor for Linux) it's possible to crop the margins by going to:&lt;/p&gt;

&lt;p&gt;"File → Document Properties → Resize Page To Content → Resize page to Drawing or Selection"&lt;/p&gt;

&lt;p&gt;That's a pain in the arse for adjusting 52 images.  Luckily, &lt;a href="https://web.archive.org/web/20120302225351/http://how-to.wikia.com/wiki/How_to_use_Inkscape_in_commandline_mode/List_of_verbs"&gt;Inkscape will take command line arguments&lt;/a&gt; (called verbs&lt;sup id="fnref:verbs"&gt;&lt;a href="https://shkspr.mobi/blog/2013/03/inkscape-cropping-svg-files-on-the-command-line/#fn:verbs" class="footnote-ref" title="Update for 2026: Verbs have been removed." role="doc-noteref"&gt;0&lt;/a&gt;&lt;/sup&gt;).  This means we can point it to all SVG files in a directory, instruct it to Fit to Drawing, and save the file again.&lt;/p&gt;

&lt;p&gt;It all takes place on one line.&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-bash"&gt;inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose *.svg
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Run that, the Inkscape window will pop up for each file, and automatically close once saved.  I'm not sure if there's a way to do it on a headless install.&lt;/p&gt;

&lt;div id="footnotes" role="doc-endnotes"&gt;
&lt;hr aria-label="Footnotes"&gt;
&lt;ol start="0"&gt;

&lt;li id="fn:verbs"&gt;
&lt;p&gt;&lt;ins datetime="2026-03-12T09:22:25+00:00"&gt;Update for 2026: &lt;a href="https://wiki.inkscape.org/wiki/Using_the_Command_Line#Changes_from_1.1"&gt;Verbs have been removed&lt;/a&gt;.&lt;/ins&gt;&amp;nbsp;&lt;a href="https://shkspr.mobi/blog/2013/03/inkscape-cropping-svg-files-on-the-command-line/#fnref:verbs" class="footnote-backref" role="doc-backlink"&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
&lt;img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=7783&amp;amp;HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager"&gt;</content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2013/03/inkscape-cropping-svg-files-on-the-command-line/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
