http://qs321.pair.com?node_id=265237


in reply to Re: too many colors, using Tk to write images
in thread too many colors, using Tk to write images

The line 228 is in the Tk module, but yeah, it's being called through the write method. Commenting that line out eliminates the error.

Assuming that the 256 colour limit is specific to the gif is a good guess. I can play with the palette values to see if that does it. I assume it's a gif thing, as just displaying the image (part of the original code I derived the example from) seems to work fine.

The quotes don't seem to matter, btw. It seems to do what I want, which I think is a result of specifying the options using the hash-like -var => value method of passing parameters.

And yeah, I'm investigating other tools. I'd forgotten about GD though. Funny that. Thanks!

elbieelbieelbie

  • Comment on (elbie): too many colors, using Tk to write images

Replies are listed 'Best First'.
Re: (elbie): too many colors, using Tk to write images
by bbfu (Curate) on Jun 12, 2003 at 01:46 UTC

    The line 228 is in the Tk module, but yeah, it's being called through the write method. Commenting that line out eliminates the error. Assuming that the 256 colour limit is specific to the gif is a good guess. I can play with the palette values to see if that does it. I assume it's a gif thing, as just displaying the image (part of the original code I derived the example from) seems to work fine.

    Then it sounds like it's definitely an issue GIF format. You need to find a way to reduce the palette down to 256 colors. Unfortunately, I didn't see any options in the Tk::Image (er, I mean Tk::Photo, and I guess you could always try calling $photo->configure(-palette => '256/256/256');) docs to do so. I'll look some more, though.

    The quotes don't seem to matter, btw. It seems to do what I want, which I think is a result of specifying the options using the hash-like -var => value method of passing parameters.

    Well, only the left side of the => operator is special. Perl would actually parse -palette => 256/256/256, as: -palette => 0.00390625, (ie, 1 divided by 256). I really don't see how that would get you anything but a monochrome image but I guess I'll take your word for it. :)

    Anyway, let us know how it all turns out for you. Good luck.

    bbfu
    Black flowers blossom
    Fearless on my breath