<?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>Schadenfreude &#187; qiv</title>
	<atom:link href="http://www.ralree.com/tag/qiv/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ralree.com</link>
	<description>Malicious enjoyment derived from observing someone else's misfortune</description>
	<lastBuildDate>Thu, 09 Feb 2012 01:49:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Finding bad JPEGs with Xorg hacks in Ubuntu</title>
		<link>http://www.ralree.com/2007/11/25/finding-bad-jpegs-with-xorg-hacks-in-ubuntu/</link>
		<comments>http://www.ralree.com/2007/11/25/finding-bad-jpegs-with-xorg-hacks-in-ubuntu/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 00:46:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[qiv]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/11/25/finding-bad-jpegs-with-xorg-hacks-in-ubuntu</guid>
		<description><![CDATA[So, I have all these JPEGs, and I want to know which ones are corrupt (specifically, ones that end prematurely). qiv will spit out the following to STDERR when it finds one: Premature end of JPEG file So, this is nice, except it&#8217;s entirely unscriptable. The solution I found was using the following script to the display the images in sequence: perl -e 'for(glob("*.png *.jpg")){$output = `qiv "$_" 2&#62;&#038;1;`; if($output =~ /Premature/){print $_, "\n";}}' All this does is mix STDERR [...]]]></description>
			<content:encoded><![CDATA[<p>So, I have all these JPEGs, and I want to know which ones are corrupt (specifically, ones that end prematurely).  <a href="http://www.klografx.net/qiv/">qiv</a> will spit out the following to <code>STDERR</code> when it finds one:</p>
<pre><code>
Premature end of JPEG file
</code></pre>
<p>So, this is nice, except it&#8217;s <strong><em>entirely unscriptable</strong></em>.  The solution I found was using the following script to the display the images in sequence:</p>
<pre><code>
perl -e 'for(glob("*.png *.jpg")){$output = `qiv "$_" 2&gt;&#038;1;`; if($output =~ /Premature/){print $_, "\n";}}'
</code></pre>
<p>All this does is mix <code>STDERR</code> with <code>STDOUT</code> for a <code>qiv</code> of the file, and check the output for the word &#8220;Premature&#8221;.  If it finds the word, it prints the filename.  Simple.</p>
<p>The only problem is that <code>qiv</code> doesnt have a way to just check whether a JPEG file is corrupt (and if there is a command line utility that does, please let me know).  To make it go thru the list, I wrote this little gem:</p>
<pre><code>
while(true); do xte "key q"; done
</code></pre>
<p>All this does is send the <code>q</code> key to the Xserver infinitely.  All I have to do is put focus on the first <code>qiv</code> window to make it and all subsequent <code>qiv</code> windows receive q&#8217;s.  So, just run it, and click on the window.  Then there are lots of flashes, and eventually that perl script will print out the names of the bad files.  It&#8217;s totally ghetto, but it&#8217;s the best I&#8217;ve got right now.  The point of this post is to hopefully find new ways to do this more programmatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/11/25/finding-bad-jpegs-with-xorg-hacks-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

