<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>

<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>Re: [Image-SIG] Dithering</TITLE>
</HEAD>
<BODY>
<DIV id=idOWAReplyText54505 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>If I were to build a 32 gray 
level palette, still composed of 256 colors, just having duplicates, 
000011111111222222222 etc. What would the code look like - general example is 
fine, I am pretty adept. I am just looking for the recommended method to 
use.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>Please include how to build and apply the 
palette.</FONT></DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>Thanks!</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> image-sig-bounces@python.org on behalf of 
Fredrik Lundh<BR><B>Sent:</B> Sun 8/28/2005 1:27 PM<BR><B>To:</B> 
image-sig@python.org<BR><B>Subject:</B> Re: [Image-SIG] 
Dithering<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>Christian M. Jensen wrote:<BR><BR>&gt; I need to take a 256 
level gray image down to 32 levels with nice<BR>&gt; dithering. What is the best 
process for doing that?<BR><BR>unless I'm missing something, I don't think you 
can do that in 1.1.5<BR>(unless you want to do the dithering by 
hand).<BR><BR>the core library can do dithering both to fixed palettes and 
optimal<BR>palettes, but PIL's convert method only exposes the "dither to 
web<BR>palette" and "map to nearest N color" variants.<BR><BR>(if you want to do 
manual dithering, use quantize(32) on the source<BR>image to get a reference 
image, take the difference between them,<BR>and propagate the errors in some 
suitable 
way)<BR><BR>&lt;/F&gt;<BR><BR><BR><BR>_______________________________________________<BR>Image-SIG 
maillist&nbsp; -&nbsp; Image-SIG@python.org<BR><A 
href="http://mail.python.org/mailman/listinfo/image-sig">http://mail.python.org/mailman/listinfo/image-sig</A><BR></FONT></P></DIV>

</BODY>
</HTML>