Greetings,
I'm new to Python and trying to use PIL to:

- Wich Colorreduce Method used PIL other as "Web"?
        "Octree" , "Median" ?

- Why has the GIF format double size?  (I use PSP as Graphic-program )
- How discover the nearest color?
        x= (r1,g1,b1) - (r,g,b)
        y= (r2,g2,b2) - (r,g,b)
        if pos(x) > pos(y): nearest=y
        else: nearest=x

I want make a script to switch the colorpalette from images.
        # numerate all pixel(palette_Id)
        MapL=list(enumerate(data_list))
        # turn round nr/palette_Id
        MapL= [(b, [a]) for a, b in MapL]
        MapL.sort()
        Listshort=[("",[""])]
        # delete all double palette_Id but put the key(nr) to it
        for value, key in MapL:
                if value != Listshort[-1][0]:
                        Listshort.append((value,key))
                else:
                        Listshort[-1][1].extend(key)
        Listshort=sorted(Listshort[1:])

        # now load a other palette and compare this
        sorted(palette1,palette2)

        # then switch the palette_Ids in Listshort and reinsert it as im.data

If it give another, better way tell it me. else i will post the
completed script.

tiny-fault-report:
I think in the PIL-Beta-Docu this Example is an fault.
http://effbot.org/imagingbook/imagepalette.htm

##Getting the Palette Contents Using Resize/Convert
assert im.mode == "P"

lut = im.resize((256, 1))
lut.putdata(range(256))
lut = im.convert("RGB").getdata()
       ^^
# lut now contains a sequence of (r, g, b) tuples

"lut" has the sequence from "im" but not from "lut.putdata(range(256))"
"lut" is a copy from "im" but "im" is not resized.
-- 
<!--Olliminatore-->
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to