<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: paint by numbers and then number by painting</title>
	<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting/</link>
	<description>Comments on Ask MetaFilter post paint by numbers and then number by painting</description>
	<pubDate>Wed, 11 Mar 2009 16:43:30 -0800</pubDate>
	<lastBuildDate>Wed, 11 Mar 2009 16:43:30 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: paint by numbers and then number by painting</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting</link>	
		<description>How can I convert a list of x, y, R, G, B coordinates into a bitmap? &lt;br /&gt;&lt;br /&gt; My &lt;a href=&quot;http://ask.metafilter.com/115743/Cartesian-bitmap&quot;&gt;previous question&lt;/a&gt; asked if there was a way to convert a bitmap into a usable set of x, y, z coordinates. A dead simple solution using the program ImageJ was suggested by kisch mokusch. &lt;br&gt;
&lt;br&gt;
But now I need to know how to do this backwards. Meaning, how can I convert a set of [x, y, R, G, B] coordinates back into a bitmap?&lt;br&gt;
&lt;br&gt;
Ideally the solution will not involve coding. Is there is an existing solution for this type of thing?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2009:site.116495</guid>
		<pubDate>Wed, 11 Mar 2009 16:30:58 -0800</pubDate>
		<dc:creator>ian1977</dc:creator>
		
			<category>bitmaps</category>
		
			<category>coordinates</category>
		
			<category>backwards</category>
		
			<category>resolved</category>
		
	</item> <item>
		<title>By: aubilenon</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670158</link>	
		<description>are x &amp;amp; y integers?  Do you have the full area covered evenly?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670158</guid>
		<pubDate>Wed, 11 Mar 2009 16:43:30 -0800</pubDate>
		<dc:creator>aubilenon</dc:creator>
	</item><item>
		<title>By: ian1977</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670161</link>	
		<description>&lt;em&gt;&lt;br&gt;
are x &amp;amp; y integers? Do you have the full area covered evenly?&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
Yes. The list of x,y RGB values will have been extracted from an existing bitmap, modified via excel or something, and then, hopefully, exported as a bitmap somehow.&lt;br&gt;
&lt;br&gt;
So, yeah, the values will all be bitmap friendly.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670161</guid>
		<pubDate>Wed, 11 Mar 2009 16:45:39 -0800</pubDate>
		<dc:creator>ian1977</dc:creator>
	</item><item>
		<title>By: Monday, stony Monday</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670164</link>	
		<description>In what order are they? If they are in order (all pixels from the first row, from left to right, then all from the second row, etc.), your task will be simpler, as you will be able to ignore the (x, y) numbers.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670164</guid>
		<pubDate>Wed, 11 Mar 2009 16:50:13 -0800</pubDate>
		<dc:creator>Monday, stony Monday</dc:creator>
	</item><item>
		<title>By: goingonit</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670167</link>	
		<description>Write a &lt;a href=&quot;http://netpbm.sourceforge.net/doc/ppm.html&quot;&gt;PPM file&lt;/a&gt; and then use an image-converter program like &lt;a href=&quot;http://www.imagemagick.org/script/index.php&quot;&gt;ImageMagick&lt;/a&gt;&apos;s convert to convert it to a .bmp.&lt;br&gt;
&lt;br&gt;
PPM files are just about the simplest things ever. You have one line that reads:&lt;br&gt;
&lt;pre&gt;P3&lt;/pre&gt; (just those characters) Then another that reads:&lt;br&gt;
&lt;pre&gt;W H&lt;/pre&gt; where W is the image&apos;s width and H is its height.&lt;br&gt;
&lt;br&gt;
Then, for each pixel (starting with the top left, then the top row second from left, etc.) you have 3 numbers from 0-255 (the R, G, B values for the pixel) separated from each other by whitespace.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670167</guid>
		<pubDate>Wed, 11 Mar 2009 16:50:53 -0800</pubDate>
		<dc:creator>goingonit</dc:creator>
	</item><item>
		<title>By: goingonit</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670169</link>	
		<description>...so if you have an Excel file with your 5-tuples, just sort them first by y, then by x. Then write the remaining 3 columns to a text file, preceded by those &quot;P3&quot; and &quot;W H&quot; lines, and you&apos;re done.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670169</guid>
		<pubDate>Wed, 11 Mar 2009 16:52:17 -0800</pubDate>
		<dc:creator>goingonit</dc:creator>
	</item><item>
		<title>By: Blazecock Pileon</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670172</link>	
		<description>Untested, but it should work or at least get you close, given a tab-delimited text file, with each 5-tuple (x, y, r, g, b) on its own line:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;#!/usr/bin/perl&lt;br&gt;
&lt;br&gt;
use warnings;&lt;br&gt;
use strict;&lt;br&gt;
use GD::Simple;&lt;br&gt;
&lt;br&gt;
# use standard input to read coordinates into array reference&lt;br&gt;
my $coordinatesRef;&lt;br&gt;
my $index = 0;&lt;br&gt;
while (&amp;lt;&amp;gt;) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;chomp($_);&lt;br&gt;
&amp;nbsp;&amp;nbsp;my @coordinates = split(&quot;\t&quot;, $_);&lt;br&gt;
&amp;nbsp;&amp;nbsp;$coordinatesRef-&amp;gt;[$index]-&amp;gt;{x} = $coordinates[0];&lt;br&gt;
&amp;nbsp;&amp;nbsp;$coordinatesRef-&amp;gt;[$index]-&amp;gt;{y} = $coordinates[1];&lt;br&gt;
&amp;nbsp;&amp;nbsp;$coordinatesRef-&amp;gt;[$index]-&amp;gt;{r} = $coordinates[2];&lt;br&gt;
&amp;nbsp;&amp;nbsp;$coordinatesRef-&amp;gt;[$index]-&amp;gt;{g} = $coordinates[3];&lt;br&gt;
&amp;nbsp;&amp;nbsp;$coordinatesRef-&amp;gt;[$index++]-&amp;gt;{b} = $coordinates[4];&lt;br&gt;
}&lt;br&gt;
 &lt;br&gt;
my $img = GD::Simple-&amp;gt;new(maxX($coordinatesRef), maxY($coordinatesRef));&lt;br&gt;
&lt;br&gt;
foreach my $coordinate (@$coordinatesRef) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;$img-&amp;gt;fgcolor($coordinate-&amp;gt;{r}, $coordinate-&amp;gt;{g}, $coordinate-&amp;gt;{b});&lt;br&gt;
&amp;nbsp;&amp;nbsp;$img-&amp;gt;rectangle($coordinate-&amp;gt;{x}, $coordinate-&amp;gt;{y}, $coordinate-&amp;gt;{x}, $coordinate-&amp;gt;{y});&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
print $img-&amp;gt;png;&lt;br&gt;
&lt;br&gt;
# subroutines&lt;br&gt;
&lt;br&gt;
sub maxX {&lt;br&gt;
&amp;nbsp;&amp;nbsp;my ($coordsRef) = @_;&lt;br&gt;
&amp;nbsp;&amp;nbsp;my $result = 0;&lt;br&gt;
&amp;nbsp;&amp;nbsp;foreach my $coord (@$coordsRef) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ($coord-&amp;gt;{x} &amp;gt; $result) { $result = $coord-&amp;gt;{x}; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;return $result;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
sub maxY {&lt;br&gt;
&amp;nbsp;&amp;nbsp;my ($coordsRef) = @_;&lt;br&gt;
&amp;nbsp;&amp;nbsp;my $result = 0;&lt;br&gt;
&amp;nbsp;&amp;nbsp;foreach my $coord (@$coordsRef) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ($coord-&amp;gt;{y} &amp;gt; $result) { $result = $coord-&amp;gt;{y}; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;return $result;&lt;br&gt;
}&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670172</guid>
		<pubDate>Wed, 11 Mar 2009 16:58:01 -0800</pubDate>
		<dc:creator>Blazecock Pileon</dc:creator>
	</item><item>
		<title>By: Blazecock Pileon</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670185</link>	
		<description>That would be: &lt;code&gt;imgScript.pl &amp;lt; myCoordinates.txt &amp;gt; myBitmap.png&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670185</guid>
		<pubDate>Wed, 11 Mar 2009 17:03:35 -0800</pubDate>
		<dc:creator>Blazecock Pileon</dc:creator>
	</item><item>
		<title>By: hexatron</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670252</link>	
		<description>Or you could edit it in a text editor and display it in any browser:&lt;br&gt;
&lt;pre&gt;&lt;br&gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Your Title Here&amp;lt;/title&amp;gt;&lt;br&gt;
&amp;lt;style&amp;gt;&lt;br&gt;
td {width:1px}&lt;br&gt;
tr {height:1px}&lt;br&gt;
&amp;lt;/style&amp;gt;&lt;br&gt;
&amp;lt;/head&amp;gt;&lt;br&gt;
&amp;lt;body&amp;gt;&lt;br&gt;
&amp;lt;table border=&apos;0&apos; cellspacing=&apos;0&apos; cellpadding=&apos;0&apos;&amp;gt;&lt;br&gt;
&amp;lt;tr&amp;gt;&lt;br&gt;
&amp;lt;td style=&apos;background-color: #ffffff&apos;/&amp;gt;&lt;br&gt;
&amp;lt;td style=&apos;background-color: #ffffff&apos;/&amp;gt;&lt;br&gt;
&amp;lt;td style=&apos;background-color: #ffffff&apos;/&amp;gt;&lt;br&gt;
&amp;lt;td style=&apos;background-color: #ffffff&apos;/&amp;gt;&lt;br&gt;
&amp;lt;td style=&apos;background-color: #ffffff&apos;/&amp;gt;&lt;br&gt;
&amp;lt;td style=&apos;background-color: #ffffff&apos;/&amp;gt;&lt;br&gt;
...&lt;br&gt;
&amp;lt;td style=&apos;background-color: #000000&apos;/&amp;gt;&lt;br&gt;
&amp;lt;td style=&apos;background-color: #000000&apos;/&amp;gt;&lt;br&gt;
&amp;lt;td style=&apos;background-color: #000000&apos;/&amp;gt;&lt;br&gt;
&amp;lt;/tr&lt;br&gt;
&amp;gt;&amp;lt;/table&amp;gt;&lt;br&gt;
&amp;lt;/body&amp;gt;&lt;br&gt;
&amp;lt;/html&amp;gt;&lt;br&gt;
&lt;/pre&gt;&lt;br&gt;
This uses the pixels in hex; you can also use&lt;br&gt;
&amp;lt;td style=&apos;background-color: rgb(255,220,0)&apos;/&amp;gt;&lt;br&gt;
if you prefer decimal red-green-blue&lt;br&gt;
&lt;br&gt;
The files are kind of big, but they compress amazingly well.&lt;br&gt;
&lt;br&gt;
&lt;/pre&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670252</guid>
		<pubDate>Wed, 11 Mar 2009 18:18:26 -0800</pubDate>
		<dc:creator>hexatron</dc:creator>
	</item><item>
		<title>By: abcde</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670596</link>	
		<description>&lt;b&gt;hexatron&lt;/b&gt; needs some sort of prize for cleverest answer. No downloads needed! &lt;a href=&quot;http://jsbin.com/ukubi&quot;&gt;Here&lt;/a&gt;&apos;s another web-based version that takes a simple CSV file (no quotes--just numbers, commas and newlines) right on the page by copy-and-paste. It uses the Canvas tag so, with a recent version of Firefox, you can right-click and save the image rather than having to do something silly like doing a print screen and cropping. I took a few minutes to adapt it from a function that does something very similar from a script I made. You&apos;d probably find it even easier than using PPM, because Excel can put out CSV.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670596</guid>
		<pubDate>Wed, 11 Mar 2009 23:57:07 -0800</pubDate>
		<dc:creator>abcde</dc:creator>
	</item><item>
		<title>By: abcde</title>
		<link>http://ask.metafilter.com/116495/paint-by-numbers-and-then-number-by-painting#1670681</link>	
		<description>Oh yeah--be mindful that Firefox might get a bit tremulous if you try to ram a million-line file into a form box. If you want to use my thing and you&apos;re dealing with big images, MeMail me and I&apos;ll change a couple of lines so you can save the page and have it work off a local file.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.116495-1670681</guid>
		<pubDate>Thu, 12 Mar 2009 04:53:37 -0800</pubDate>
		<dc:creator>abcde</dc:creator>
	</item>
	</channel>
</rss>
