I called rgb2n on $clr and then it worked.

Hm. That is weird. And I mean re-ally weird!.

$clr is (already) a number in the range 0 .. 2**24: my $clr = 2**24 / $step;, where $step interates from 10 .. 1.

rgb2n() expects input of 3 numbers in the range 0 .. 255, which it then converts to a number in the range 0 .. 2**24. So, besides the crapload of warning that should have been issued, half the lines on the graph would have been drawn in black on black:

c:\test>p1 [0] Perl> sub rgb2n { unpack 'N', pack 'CCCC', 0, @_ } ;; [0] Perl> print rgb2n( 2**24 / $_ ) for reverse 1 .. 10;; Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 10027008 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 13041664 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 0 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 4784128 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 11141120 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 3342336 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 0 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 5570560 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 0 Character in 'C' format wrapped in pack at (eval 6) line 1, <STDIN> li +ne 3. 0

The only possible explanation I can hazard at for this, is that you have a very (very(very)) old version of GD installed that only supports 8-bit color?

Like pre-v2.0. The libgd history doesn't list dates, but from memory, it must at least 5 years ago. I provided a patch for 2.3x, and that was at least 4 years ago.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^3: build a distribution by BrowserUk
in thread build a distribution by Grig

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.