Image.putpalette(Colors)?

O

Oliver Albrecht

Has somebody a example-script how i can put a other palette to a image?
(after this the image should have similar outlook)
 
O

Oliver Albrecht

Thanks,
I've read this page.( out of date ?)
http://www.pythonware.com/products/pil/articles/creating-palette-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
 
O

Oliver Albrecht

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
 
O

Oliver Albrecht

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top