<?xml version="1.0" encoding="UTF-8"?>
<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>infotexture &#187; tips</title>
	<atom:link href="http://infotexture.net/tag/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://infotexture.net</link>
	<description>Information Architecture &#38; Content Strategy</description>
	<lastBuildDate>Sat, 03 Sep 2011 14:59:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>DITA-OT: Scaling Images in PDF Output</title>
		<link>http://infotexture.net/2010/03/dita-ot-scaling-images-in-pdf-output/</link>
		<comments>http://infotexture.net/2010/03/dita-ot-scaling-images-in-pdf-output/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 19:02:32 +0000</pubDate>
		<dc:creator>roger</dc:creator>
				<category><![CDATA[DITA]]></category>
		<category><![CDATA[DITA-OT]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://infotexture.net/?p=340</guid>
		<description><![CDATA[When generating PDF output via the DITA Open Toolkit, users often stumble over image scaling issues. While smaller graphics are typically rendered without problems, large images may extend beyond the page dimensions, throw errors in the log file or not appear at all. So we need a way to downscale larger images. There are basically [...]]]></description>
			<content:encoded><![CDATA[<p>When generating PDF output via the <a href="http://sourceforge.net/projects/dita-ot/">DITA Open Toolkit</a>, users often stumble over image scaling issues. While smaller graphics are typically rendered without problems, large images may extend beyond the page dimensions, throw errors in the log file or not appear at all. So we need a way to downscale larger images. </p>

<p><strong>There are basically two options:</strong> either add image dimensions to the DITA source files, or adjust the resolution of the images themselves. The latter can be done by hand, via batch processing, or with a system-wide service.</p>

<h2>Specifying Dimension Attributes in DITA Markup</h2>

<p>Recent toolkit versions <em>(as of 1.4.3)</em> honor the dimension-related attributes in the <code>&lt;image&gt;</code> element, so specifying the height or width of the image is often enough: 
<code>&lt;image href="../path/to/file.png" placement="break" width="15cm"/&gt;</code>.</p>

<p>This first method affects both HTML and PDF output. However, if you&#8217;re using an older toolkit version, if modifying your DITA source files isn&#8217;t an option, or if you only want to change the scale in PDFs <em>(but not in HTML)</em>, you may be better off changing the metadata of the image files instead.</p>

<h2>Adjusting Image Resolution</h2>

<p>If you’re using RenderX <a href="http://www.renderx.com/tools/xep.html">XEP</a> to produce PDFs, setting the image resolution to 120 dpi will often do the trick. The <em>XEP User Guide</em> includes this useful bit of wisdom:</p>

<blockquote>
  <p>Bitmap graphic[s] that have no built-in resolution or 
  dimension data, default to a resolution of 120 dpi (5 dots of a
  600-dpi printer) as prescribed by the CSS2 Spec. </p>
</blockquote>

<p>So that’s what we need to know: <strong>XEP assumes a resolution of 120 dpi</strong>. </p>

<p>As the <em>User Guide</em> explains:</p>

<blockquote>
  <p>This is always the case for GIF images, but may also occur with other image types. The XSL Recommendation suggests using 0.28 mm as a pixel size in such cases, which corresponds to 90 dpi resolution. A smaller pixel size gives better print results because the proportion between pixel size and page width is similar to that of a computer screen. With lower resolutions, often the large GIF/JPEG images fit onto a screen but not into the printable area on the page.</p>
</blockquote>

<p>You can use your favorite pixel graphics program to change the image resolution to 120 dpi. You don&#8217;t want to resample the image, only change the dpi setting (or <em>“pixel density”</em>) in the image metadata.</p>

<p>This is easy to do by hand for a single image, but it quickly gets tedious for large numbers of files.</p>

<h2>Processing with ImageMagick</h2>

<p>As the name suggests, the <a href="http://www.imagemagick.org/">ImageMagick</a> software suite provides a powerful arsenal of tools and wizardry that can be used to perform any number of tricks on individual images, or entire directories.</p>

<p>If you&#8217;re running Mac OS X, you can use <a href="http://www.macports.org/install.php">MacPorts</a> to install ImageMagick:</p>

<pre><code>sudo port install ImageMagick  
</code></pre>

<p>The versatile <a href="http://www.imagemagick.org/script/mogrify.php">mogrify</a> command included with ImageMagick can be used to edit images in place, overwriting the original files. The <code>units</code> and <code>density</code> options will do just what we need:</p>

<pre><code>mogrify -units PixelsPerInch -density 120 test.png  
</code></pre>

<p>This sets the pixel density of <code>test.png</code> to 120 dpi. To process all PNG files in a folder, use:</p>

<pre><code>mogrify -units PixelsPerInch -density 120 *.png  
</code></pre>

<p>These commands can be adjusted to process all image types in a folder at once, or chain other effects <em>(such as drop shadows)</em> into a single command.</p>

<h2>Creating a Mac OS X Service with Automator</h2>

<p>If you’re a little leery of the command line and prefer something a bit more user-friendly, you can use Automator to create a system-wide service. Then changing the resolution for a selection of files is as easy as selecting a command from the <strong>Services</strong> menu.</p>

<p>To create the service with Mac OS 10.6 <em>Snow Leopard:</em> </p>

<ol>
<li>Open <code>/Applications/Automator.app</code>, select the <strong>Service</strong> template and click <strong>Choose</strong>.</li>
<li>At the top of the workflow area on the right side of the window, change the first list option to <strong>image files</strong>.</li>
<li>From the <strong>Automator</strong> library, add the <strong>Run Shell Script</strong> action.
Leave the <strong>Shell</strong> set to <code>/bin/bash</code>, set <strong>Pass input</strong> to <code>as arguments</code>, and replace <code>echo</code> in the default script with <code>/opt/local/bin/mogrify -units PixelsPerInch -density 120</code>.</li>
</ol>

<p>When you&#8217;re done, the Automator dialog should look like this:</p>

<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://infotexture.net/wp-content/uploads/2011/01/ImageMagick-workflow-service.png" alt="ImageMagick workflow service.png" border="0" width="542" height="402" /></p>

<p>Save the workflow as a service, and you can run it on files &amp; folders in the Finder by Control-clicking and choosing your new command from the <strong>Services</strong> submenu in the shortcut menu.</p>

<p>If you&#8217;d rather just download a copy of my service, you&#8217;ll find it <a href="http://downloads.infotexture.net/ImageMagick-workflow-service.zip">here</a>. Unpack the archive and copy the contents to <code>~/Library/Services</code>.</p>

<hr />
]]></content:encoded>
			<wfw:commentRss>http://infotexture.net/2010/03/dita-ot-scaling-images-in-pdf-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snow Leopard Services: Set ZIP File Date</title>
		<link>http://infotexture.net/2009/11/snow-leopard-services-set-zip-file-date/</link>
		<comments>http://infotexture.net/2009/11/snow-leopard-services-set-zip-file-date/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 20:05:15 +0000</pubDate>
		<dc:creator>roger</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Automator]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://blog.infotexture.net/?p=305</guid>
		<description><![CDATA[One of the more popular posts on this site is an entry from October of 2007 on creating a ZIP archive and setting the modification date via an Automator workflow. As I wrote then: “&#8230;when you’re archiving older data, it’s much more useful for the ZIP file date to reflect the date of its contents, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.infotexture.net/wp-content/uploads/2009/11/advanced-preferences-icon.png" alt="advanced-preferences-icon.png" border="0" width="32" height="32" align="right" />One of the more popular posts on this site is an entry from October of 2007 on <a href="http://blog.infotexture.net/2007/10/18/automator-workflow-set-zip-file-date/">creating a ZIP archive and setting the modification date</a> via an <a href="http://www.macosxautomation.com/automator/">Automator</a> workflow. </p>

<p>As I wrote then:</p>

<blockquote>
  <p>“&#8230;when you’re archiving older data, it’s much more useful for the ZIP file date to reflect the date of its contents, since a few years from now you probably won’t care when you compressed the stuff, but rather how old the files inside are.”</p>
</blockquote>

<p>With Mac OS 10.6 <em>Snow Leopard,</em> this same workflow can be set up to run as a service, accessible from the context menu in any Finder window. The process is essentially the same as described in the <a href="http://blog.infotexture.net/2007/10/18/automator-workflow-set-zip-file-date/">original post</a>, with the following adjustments:</p>

<p>To create the workflow,</p>

<ol>
<li>Open <code>/Applications/Automator.app</code>, select the <strong>Service</strong> template and click <strong>Choose</strong>.</li>
<li>At the top of the workflow area on the right side of the window, change the first list option to <strong>files or folders</strong>.</li>
<li>From the <strong>Finder</strong> library, drag the <strong>Create Archive</strong> action to the workflow area. In the action settings, specify the default name and location for the archive file. <em>(I prefer the same name &amp; folder as the input, but you can set the <strong>Options</strong> to prompt for this information when the workflow runs.)</em></li>
<li>From the <strong>Automator</strong> library, add the <strong>Run Shell Script</strong> action.
Leave the <strong>Shell</strong> set to <code>/bin/bash</code>, set <strong>Pass input</strong> to <code>as arguments</code>, and replace the default script in the text box with <code>zip -o "$@"</code>.</li>
</ol>

<p>Save the workflow as a service, and you can run it on files &amp; folders in the Finder by Control-clicking and choosing your new command from the <strong>Services</strong> submenu in the shortcut menu.</p>

<p class="note"><strong>Note:</strong> To create a service that will set the date for existing ZIP files, skip Step 3 above.</p>
]]></content:encoded>
			<wfw:commentRss>http://infotexture.net/2009/11/snow-leopard-services-set-zip-file-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PDF2: Removing Page Numbers from Cross References and Customizing Cover Pages</title>
		<link>http://infotexture.net/2009/02/pdf2-removing-page-numbers-from-cross-references-and-customizing-cover-pages/</link>
		<comments>http://infotexture.net/2009/02/pdf2-removing-page-numbers-from-cross-references-and-customizing-cover-pages/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 16:47:54 +0000</pubDate>
		<dc:creator>roger</dc:creator>
				<category><![CDATA[DITA]]></category>
		<category><![CDATA[DITA-OT]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.infotexture.net/?p=285</guid>
		<description><![CDATA[Dan Ochs of Wrycan Inc. has posted several nice tutorials on customizing the output produced by the DITA Open Toolkit PDF2 Plugin: one covers removing page numbers from cross references, and another explains how to modify PDF2 cover pages to include a company logo. Nice job Dan!]]></description>
			<content:encoded><![CDATA[<p>Dan Ochs of <a href="http://xsl.wrycan.com/">Wrycan Inc.</a> has posted several nice tutorials on customizing the output produced by the <a href="http://sourceforge.net/projects/dita-ot/">DITA Open Toolkit</a> PDF2 Plugin:</p>

<ul>
<li>one covers <a href="http://wrycan.blogspot.com/2009/02/how-to-customize-dita-open-toolkit-pdf.html">removing page numbers</a> from cross references, and </li>
<li>another explains how to <a href="http://wrycan.blogspot.com/2009/02/how-to-modify-cover-page-in-dita-open.html">modify PDF2 cover pages</a> to include a company logo.</li>
</ul>

<p>Nice job Dan!</p>
]]></content:encoded>
			<wfw:commentRss>http://infotexture.net/2009/02/pdf2-removing-page-numbers-from-cross-references-and-customizing-cover-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

