[Image-SIG] Help Experimental (palette)
Oliver Albrecht
550283447739-0001 at t-online.de
Tue Jun 7 00:35:05 CEST 2005
Hello again,
I love PIL and would like support this.(,no matter whether it is
commercial) Sorry if my last messages was bad.
I've experimented with palette.save/load options and i extended the
palette.save/load functions.
It is not important, but it can be attained without large expenditure.
The Gimp and PaintShopP palette files are very similar.
I mean can bring in it in the next version!?
# add some psuedocolour palettes as well
( successfully tested with Gimp2.2 and PSP9.0) example:
def save(self, fp , art="GIMP"):
# (experimental) save palette to text file
des=""
if self.rawmode:
raise ValueError("palette contains raw palette data")
if type(fp) == type(""):
if art and art[:4] == "GIMP":
fp = open(fp, "wb")
fp.write("%s\n# Mode: %s\n" % ("GIMP Palette",self.mode))
des='" %i" % i' ##FIXME color description
elif art[:4] == "JASC":
fp = open(fp, "w")
fp.write("JASC-PAL\n0100\n256\n")
else:
raise ValueError, "wrong palette type"
for i in range(256):
fp.write("%d %d %d" % (self.palette[i] ,self.palette[i+256],
self.palette[i+512]))
fp.write("%s\n" % eval(des))
fp.close()
And again a big Question:
How i can load the palette from FLI/FLC files, or is it experimental
and/or not yet supported? The palette of each band is only gray.
Sorry if my english is to bad.
I've attached the sample Modul JascPaletteFile
--
<!O>input<?/>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: JascPaletteFile.py
Url: http://mail.python.org/pipermail/image-sig/attachments/20050607/5bd7ff0c/JascPaletteFile.ksh
More information about the Image-SIG
mailing list