<?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>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</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[@edent]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 14:04:38 +0000</pubDate>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[inkscape]]></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><![CDATA[<p>A little post as an <em>aide-mémoire</em>.</p>

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

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

<p>"File → Document Properties → Resize Page To Content → Resize page to Drawing or Selection"</p>

<p>That's a pain in the arse for adjusting 52 images.  Luckily, <a href="https://web.archive.org/web/20120302225351/http://how-to.wikia.com/wiki/How_to_use_Inkscape_in_commandline_mode/List_of_verbs">Inkscape will take command line arguments</a> (called verbs<sup id="fnref:verbs"><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">0</a></sup>).  This means we can point it to all SVG files in a directory, instruct it to Fit to Drawing, and save the file again.</p>

<p>It all takes place on one line.</p>

<pre><code class="language-bash">inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose *.svg
</code></pre>

<p>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.</p>

<div id="footnotes" role="doc-endnotes">
<hr aria-label="Footnotes">
<ol start="0">

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

</ol>
</div>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=7783&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></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>
