469,356 Members | 1,947 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Image.putpalette(Colors)?

Has somebody a example-script how i can put a other palette to a image?
(after this the image should have similar outlook)
Jul 19 '05 #1
4 5507
Oliver Albrecht wrote:
Has somebody a example-script how i can put a other palette to a image?
here's one of the first google hits for "PIL putpalette":

http://effbot.org/zone/pil-pseudocolor.htm
(after this the image should have similar outlook)


similar to what?

</F>

Jul 19 '05 #2
Thanks,
I've read this page.( out of date ?)
http://www.pythonware.com/products/p...tte-images.htm

Very nicely to become answered from the major author and python genius
highly personally himself :-D

Which I want to do is; convert several "RGB" Images (or "P") with one
specified palette (to "P").
Or this (for "P")pattern; if the Source Image has the exact same colors but
wrong(other) paletteIds, how can i sort this? With List.sort()?
And give each pixel the right paletteId? That is what i mean with similar
image (source"RGB" to destinaton"P").

convert() without "WEB"?

(sry if i've enough experience with python)>=newbie

Jul 19 '05 #3
I mean equal outlook.
Or as other objective: give some Images (which has all same colors but
other palettes) for an Animation the same/one palette and nothings is
changed in their outlook
Jul 19 '05 #4
I think in this Example is an fault
lut has the sequence from "im" but not from "lut.putdata(range(256))"

##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

Fredrik Lundh wrote:
here's one of the first google hits for "PIL putpalette":

http://effbot.org/zone/pil-pseudocolor.htm


Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Michel | last post: by
4 posts views Thread by MC D | last post: by
reply views Thread by Denise | last post: by
5 posts views Thread by Tony Clark | last post: by
7 posts views Thread by Wes Groleau | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.