[PD] [pix_data] - convert rgb values to pd canvas format

Roman Haefeli reduzent at gmail.com
Fri Jan 1 13:10:21 CET 2016


On Thu, 2015-12-31 at 18:01 +0100, João Pais wrote:
> If understandable, I send this patch so that it's possible to see what
> I'm doing.
> 
> 
> The idea is actually to convert a pix into a bunch of canvases, pixel
> per pixel - so that a "picture" can be shown on vanilla. Follow the
> instructions in the patch, and everything should be clear.
> The conversion is done in [pd RGB]. There are 2 versions, but they
> have the same output.

There are quite a few different color encodings around in Pd world. For
the iemguis, there is a difference in encoding between sending a 'color'
message and defining a color as creation argument. What you've done
works well for sending 'color' messages to canvas, but not as a creation
argument. If you want to define a color as creation argument, you have
to encode it differently, namely as 6bit-per-channel value. So, instead
of multiplying by 255 and powers of 256, you need to multiply by 63 and
powers of 64. See attached patch. 

I guess the reason is a limitation in how Pd displays (and saves)
numbers. Although 32-bit float numbers can fully represent 24bit integer
numbers, numbers are saved with less precision in pd files (and text
files), since they are truncated to 6 digits. This limitation is
worked-around by reducing the resolution to 6 bits per channel. The
highest number (the one representing white) is -262144. It does not
exceed 6 digits and can be stored at full precision.

Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: convert_rgb2iemcreate.pd
Type: text/x-puredata
Size: 1346 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20160101/727a3344/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20160101/727a3344/attachment.sig>


More information about the Pd-list mailing list