<?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>thorx.net &#187; experiments</title>
	<atom:link href="http://blog.thorx.net/tag/experiments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thorx.net</link>
	<description>...to confuse &#38; unexpect‽</description>
	<lastBuildDate>Tue, 31 Mar 2020 12:54:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6.1</generator>
		<item>
		<title>Multi quality JPEG hack</title>
		<link>http://blog.thorx.net/2011/07/multi-quality-jpeg-hack/</link>
		<comments>http://blog.thorx.net/2011/07/multi-quality-jpeg-hack/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 05:55:50 +0000</pubDate>
		<dc:creator>nemo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://blog.thorx.net/?p=284</guid>
		<description><![CDATA[tl;dr: In which I attempt to montage jpeg which comprises areas of differing internal jpeg quality, for fun and, er&#8230; artistic geeky interest. You see, once upon a time, I was thinking about lossless jpeg editing. The sort that jpegtran can do. jpegtran (1) - lossless transformation of JPEG files Specifically, jpegtran can (with some [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>tl;dr:</strong> In which I attempt to montage jpeg which comprises areas of differing <strong>internal jpeg quality</strong>, for fun and, er&#8230;<span style="text-decoration: line-through;"> artistic</span> geeky interest.<br />
<span id="more-284"></span>You see, once upon a time, I was thinking about lossless jpeg editing. The sort that jpegtran can do.</p>
<pre>jpegtran (1)         - lossless transformation of JPEG files</pre>
<p>Specifically, jpegtran can (with some understandable limits) rotate/flip and mirror losslessly, and also crop &#8211; for values of &#8220;lossless&#8221; that only apply to the cropped image data.</p>
<p>I soon got to wondering if the reverse could also be true. If jpeg image data can be cropped losslessly; then it must not rely on surrounding data and so surely paste is equally possible.</p>
<p>I researched some and found&#8230; <a href="http://www.imagemagick.org/Usage/formats/#jpg_lossless">http://www.imagemagick.org/Usage/formats/#jpg_lossless</a>. If you scroll down to the &#8216;Mixed JPEG Quality&#8217; section it&#8217;s suggested:</p>
<blockquote><p>* use jpegtran to merge the q60 on top of the q100</p></blockquote>
<p>&#8220;So&#8221;, I thinks to myself, &#8220;&#8230;jpegtran can do that, huh?&#8221;</p>
<p>Turns out that it can&#8217;t. Not the version currently in Debian anyway.</p>
<p>&#8230;But an experimental version can. See the version that the chaps have here: <a href="http://jpegclub.org/jpegtran/">http://jpegclub.org/jpegtran/</a></p>
<div id="attachment_285" class="wp-caption alignleft" style="width: 310px"><a rel="attachment wp-att-285" href="http://blog.thorx.net/2011/07/multi-quality-jpeg-hack/kwalitee/"><img class="size-medium wp-image-285" title="kwalitee" src="http://blog.thorx.net/wp-uploads/2011/06/kwalitee-300x192.jpg" alt="Multi Quality JPEG" width="300" height="192" /></a><p class="wp-caption-text">Only the original 1600x1024 is a true quality hybrid</p></div>
<p>The information on that page indicates to me that the &#8216;drop&#8217; option has been experimental since 2000 at least&#8230; and I wonder why it&#8217;s not mainstream then. But, let&#8217;s take a look anyway. There are helpful binaries and a sample script provided, but I had something a bit more fun in mind.</p>
<p>One download later, and some fiddling around&#8230; and here is this! IMAG KWALITEE for all!</p>
<p>Counting from the bottom where it&#8217;s most evident, the rows of 80 pixels high each are of quality 1, 4, 5, 6, 7, 8, 9, 10, 15, 20, 50, and the final 144 pixels at the top are original (ie, camera sourced jpeg with text composited in and saved at quality 100).</p>
<p>The resulting image is 153k in size. In this example, a normal save of the source (captioned) image at a quality of 72 results in an image of equivalent size.</p>
<p>Speaking of size, since the cropped rows exist as images on their own, I can also see how much space each quality section uses.  So the  q1 row (80pixels high &#8211; or about 8% of the final image) is just a tad  over 3k in size &#8211; that is, about 2% of the bytes, and even the quality 50  stripe is only 8k &#8211; 5.5% of the bytes. However, the q100 stripe at the  top &#8211; 144 pixels comprising 14% of the pixel space, and is a whopping 66% of  the bytes!</p>
<p>In another example image, I discovered that you cannot drop a  colour segment onto a greyscale image (but you CAN drop a greyscale  segment onto a colour image, and then subsequently drop a colour segment  within the greyscale. The resulting possum is shown, but I wont go into the making-of here.</p>
<h3>Additional notes</h3>
<p>In creating this, I found a few caveats&#8230;</p>
<div id="attachment_296" class="wp-caption alignright" style="width: 310px"><a rel="attachment wp-att-296" href="http://blog.thorx.net/2011/07/multi-quality-jpeg-hack/possum_final/"><img class="size-medium wp-image-296" title="Possum with border" src="http://blog.thorx.net/wp-uploads/2011/06/possum_final-300x200.jpg" alt="Jpeg multi-quality hack of a possum " width="300" height="200" /></a><p class="wp-caption-text">This tree is terrible! It has a monotone border bits AND bad compression</p></div>
<ul>
<li> Make sure the crops and drops are aligned on the jpeg iMCU  boundaries, or headaches ensue since the crop size will be silently  altered in position (as, I think, is the drop). I made all my changes on  the boundary of 16&#215;16 blocks, though 8&#215;8 is also possible (I believe this may depend on  the jpeg)</li>
<li> I had to set the caption text to a light grey after I found that pure white  would cause jpeg errors when dropping (DCT coefficient out of range). I  don&#8217;t know if this is a bug, or just a limitation in what&#8217;s possible due  to jpeg encoding.</li>
<li> A colour jpeg loses it&#8217;s colour when dropped onto a greyscale jpeg. Specifically:
<ol>
<li> crop &#8216;cropped.jpg&#8217; from colour source.jpg</li>
<li> also create greyscale.jpg from source.jpg</li>
<li> drop &#8216;cropped.jpg&#8217; back onto the original location within greyscale.jpg to create merged.jpg</li>
<li> merged.jpg is not a grey-with-colour-segment jpeg, but is all grey. in fact, it&#8217;s so grey that merged.jpg and greyscale.jpg are binary identical!</li>
</ol>
<ul>
<li> note: tested just once :)</li>
</ul>
</li>
<li> real-world practical applications of this? <a href="http://www.photopla.net/wwp0703/stripes.php">http://www.photopla.net/wwp0703/stripes.php</a> &#8230;that&#8217;s probably about it. Any stylistic effect from this is likely achievable with less effort via a standard photo editor (The GIMP, etc) with the cost of a few % in filesize when saving at a high enough quality to ensure actual jpeg artifacts don&#8217;t spoil the effect.</li>
</ul>
<p>This page is derived from my wiki notes on the subject, which include additional information/updates for the inquisitive.</p>
<p>See: <a href="http://wiki.thorx.net/wiki/JPEGhack">http://wiki.thorx.net/wiki/JPEGhack</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thorx.net/2011/07/multi-quality-jpeg-hack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>my experiment in custom iPhone ringtones via linux</title>
		<link>http://blog.thorx.net/2010/08/my-experiment-in-custom-iphone-ringtones-via-linux/</link>
		<comments>http://blog.thorx.net/2010/08/my-experiment-in-custom-iphone-ringtones-via-linux/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 15:04:06 +0000</pubDate>
		<dc:creator>nemo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://blog.thorx.net/?p=194</guid>
		<description><![CDATA[thanks to recent nautilus (I assume is responsible &#8211; as seen in Ubuntu Lucid Lynx) ability to view the iPhones file paths, we can try this (typing this as I go, so this is draft on-the-fly quality notes) * create an m4a file (I made mine exactly 40seconds according to audacity and saved as a [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>thanks to recent nautilus (I assume is responsible &#8211; as seen in Ubuntu Lucid Lynx) ability to view the iPhones file paths, we can try this (typing this as I go, so this is draft on-the-fly quality notes)<span id="more-194"></span></p>
<p>* create an m4a file (I made mine exactly 40seconds according to audacity and saved as a .wav, then used faac to convert to m4a (faac in.wav &#8211;title &#8220;ringtone experiment&#8221; -o tone.m4a ; mv tone.m4a tone.m4r)</p>
<p>* copy tone into iPhone://iTunes_Control/Ringtones/tone.m4r</p>
<p>* edit iPhone://iTunes_Control/iTunes/Ringtones.plist to add in the details of the new ringtone. Fortunately I had an existing one already, so I just copied that &#8211; updating the GUID (I changed one character), the Name (&#8220;funky new ringtone&#8221;) and the Total Time (40000) fields.</p>
<p>&#8230;and bingo, the ringtone is visible in the settings (selectable, plays), but does not lock in as the ringtone to use! ok, clearly some work needed.</p>
<p>incidentally, this is a 32GB iPhone 3Gs with iOS4.0.2, never been jailbroken or anything underhanded done to it before. It was unlocked from the carrier a few days ago (thanks .au law) and that required a lengthy restore, but otherwise smooth.</p>
<p>&#8230;ok, so back to it: plugged it into iTunes (Mac) &#8211; it couldn&#8217;t read from the device (an error!)</p>
<p>&#8230;rebooted phone &#8211; and the new ring tone now works correctly. YAY! =)  is this success?</p>
<p>&#8230;plugging it into iTunes again and&#8230; it&#8217;s all &#8220;Verifying iPhone&#8221; at me &#8211; something I don&#8217;t generally recall. &#8230;ok, it&#8217;s backing up as normal now&#8230;</p>
<p>and the ringtone tab in iTunes tells me it doesn&#8217;t know about the tone I added in, it&#8217;s syncing, so I suspect it&#8217;ll delete my added tone&#8230;</p>
<p>&#8230;and checking in my iPhone after it&#8217;s done, what do you know &#8211; my custom added ringtone is all gone. Checking back via linux &#8211; and the tone.m4r file has been deleted, Ringtones.plist has been completely rewritten.</p>
<p>So, I assume (not surprisingly at all) that iTunes needs to know about it, as the authorative master, and tell the iPhone how it&#8217;s gonna be. This fits with my observed philosophy of the iPhone &#8211; as an adjunct to the master information on the computer.</p>
<p>&#8230;</p>
<p>so, round 2&#8230; I add the m4r into the iTunes library &#8211; it automatically adds it in as a ringtone &#8211; that&#8217;s nice. I assume iTunes assumed it was a ringtone by the file extension. And in the iPhone tab it shows up as available to be sync&#8217;d&#8230; and bingo. it works.</p>
<p>ok, so not a pure linux solution &#8211; unless you never sync your phone to iTunes anyway &#8211; but it DOES let you make a custom ringtone without requiring garageband. That&#8217;s something isn&#8217;t it?</p>
<p>And I assume the method would work under windows too&#8230; anyone want to give it a go and get back to me? <img src='http://blog.thorx.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thorx.net/2010/08/my-experiment-in-custom-iphone-ringtones-via-linux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Magnets vs ATM cards</title>
		<link>http://blog.thorx.net/2009/07/magnets-vs-atm-cards/</link>
		<comments>http://blog.thorx.net/2009/07/magnets-vs-atm-cards/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 11:18:02 +0000</pubDate>
		<dc:creator>nemo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[magnets]]></category>

		<guid isPermaLink="false">http://blog.thorx.net/?p=33</guid>
		<description><![CDATA[For some time I have been&#8230; let&#8217;s say, mildly annoyed, at what I see as a cultural paranoia regarding magnets. This has come about, imho, due to the prevalence of ATM cards for finances, harddrives for data storage, and an unawareness of what it takes to magnetically corrupt these media. I even had a friend [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>For some time I have been&#8230; let&#8217;s say, mildly annoyed, at what I see as a cultural paranoia regarding magnets. This has come about, imho, due to the prevalence of ATM cards for finances, harddrives for data storage, and an unawareness of what it takes to magnetically corrupt these media. I even had a friend (who works in IT!) make strong worrying noises once about data corruption on my hard drives simply because I had a fridge magnet applied to the outside of my case.</p>
<p>Now whilst I was certain that was not a problem, I confess to general ignorance on the subject, and so I intended to do something to correct it. Something a little fun. <span id="more-33"></span></p>
<p>Thus, when I recieved the replacement for one of my older ATM cards, I ventured to my nearest ATM with magnets and a plan. Three magnets to be precise. A very weak fridge magnet, a strong fridge magnet (both these of the &#8216;flexible plastic&#8217; variety), and a small (10x20x3mm) rare earth magnet.</p>
<p>So how much magnetism on the card would stop it working?</p>
<p>I&#8217;ll cut to the chase&#8230;<br />
Both fridge magnets had no apparent effect after a 1 second swipe over the magnetic strip. A 10 second &#8216;random smearing&#8217; by the strong fridge magnet still yielded no failure in the basic &#8216;show me the balance&#8217; task.</p>
<p>But a one second swipe with the rare earth, and, not expectantly, the card no longer was readable. I tried two machines, same dice.</p>
<p>Next time: hard drives&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thorx.net/2009/07/magnets-vs-atm-cards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
