I'm trying to use Tk to superimpose two images, then write them back out again, but I'm getting an error "too many colors at /Library/Perl/darwin/Tk.pm line 228."
Here's a scaled down script that reproduces the error:
#! /usr/bin/perl -w
use strict;
use Tk;
my( $background, $score_pip );
# Main
{
my $top = MainWindow->new();
$background = $top->Photo( -file => "QBackground.gif",
# -palette => 256/256/256,
);
$score_pip = $top->Photo( -file => "Score.gif",
# -palette => 256/256/256,
);
$background->copy( $score_pip, -to => ( 180 - 16, 180 - 16 ));
# $background->redither;
$background->write(
'testout.gif',
-format => 'gif',
# -grayscale,
);
}
I tried playing with the palette options, and the redither method (commented out above) to see if they would help, but they didn't.
The greyscale option helped, of course, but the image was in greyscale. Not so good.
Also, is there a way to generate a Photo object without creating it using a parent object? I tried $foo = Tk::Photo( ... ) and similar, but those didn't seem to work.
elbieelbieelbie
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.