[27154] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8996 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 26 09:05:55 2006

Date: Sun, 26 Feb 2006 06:05:03 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 26 Feb 2006     Volume: 10 Number: 8996

Today's topics:
    Re: A Problem With GD <markem@airmail.net>
    Re: A Problem With GD <1usa@llenroc.ude.invalid>
    Re: A Problem With GD <markem@airmail.net>
    Re: A Problem With GD <uri@stemsystems.com>
    Re: A Problem With GD <uri@stemsystems.com>
    Re: A Problem With GD <uri@stemsystems.com>
    Re: A Problem With GD <1usa@llenroc.ude.invalid>
        Sigils <sinister@nospam.invalid>
    Re: Sigils <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 25 Feb 2006 20:27:58 -0600
From: Mark Manning <markem@airmail.net>
Subject: Re: A Problem With GD
Message-Id: <12024f9q5rstfc5@corp.supernews.com>

Thanks Rob.  Elloquent and to the point.  :-)

Sisyphus wrote:

> Like you, I find that if I use the values that are commented out (they're...
> Cheers,
> Rob
> 
> 



------------------------------

Date: Sun, 26 Feb 2006 02:30:59 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: A Problem With GD
Message-Id: <Xns9775DAF97D222asu1cornelledu@127.0.0.1>

"Sisyphus" <sisyphus1@nomail.afraid.org> wrote in
news:44010b73$0$17406$afc38c87@news.optusnet.com.au: 

> 
> "Mark Manning" <markem@airmail.net> wrote in message
> news:1201gn750d926e1@corp.supernews.com...
> 
>> Ok - here ya go!  :-)
>>
> 
> Best to post a *minimal* script that exhibits the problem. Here's all
> that's needed (though it can probably be reduced further):
> 
> use GD;
> use warnings;
> use strict;
> GD::Image->trueColor(1);

 ...

> Like you, I find that if I use the values that are commented out
> (they're the values you used for for the first image files), then
> there's no problem. But if I run that script as is (using the values
> you used for the second image files), I get those extra lines of extra
> dots in the gif file. So .... the strangeness you report is dependent
> upon the values that are given to $fg_r, $fg_b, $fg_g, $bg_r, $bg_b,
> and $bg_g ... and probably upon something else as well ... but I don't
> know what :-) 

May be the fact that GIF is a palette format, and therefore from a true 
color image to a palette image involves dithering by default has 
something to do with it, don't you think?

Observe the difference in behavior by changing the epilogue of the 
script you posted to:

open( OUTFILE, ">TestPic2.png" ) || die $!;
binmode OUTFILE;
print OUTFILE $b->png;
close( OUTFILE );

$b->trueColorToPalette(0, 16);
open( OUTFILE, ">TestPic2.gif" ) || die $!;
binmode OUTFILE;
print OUTFILE $b->gif;
close( OUTFILE );

I find the default behavior completely acceptable: After all, most true 
color images one is going to output in palette format will look better 
with dithering.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



------------------------------

Date: Sat, 25 Feb 2006 20:32:57 -0600
From: Mark Manning <markem@airmail.net>
Subject: Re: A Problem With GD
Message-Id: <12024onlc3vko25@corp.supernews.com>



>>A. Sinan Unur wrote:

> It is especially important to ask Perl to help you when you are having 
> problems, don't you think?

Not really.  I am a bit older then five and I've been using Perl since 
almost the beginning.  I know, pretty well, what Perl can and can not do.

> Then you might have noticed at least one of those calls returning -1?

Not on my machine it doesn't.

> That is your problem.

No - it's Netscape's problem.


> But a cute one: 
> http://www.unur.com/sinan/album/tr_072005/2005_0809_064336aa.jpg
> 
> Bye!
> 

Beauty is in the eye of the beholder.



------------------------------

Date: Sun, 26 Feb 2006 01:20:12 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: A Problem With GD
Message-Id: <x7psla7iar.fsf@mail.sysarch.com>

>>>>> "MM" == Mark Manning <markem@airmail.net> writes:

  MM> A. Sinan Unur wrote:

  >> Reduce the number of declarations by grouping appropriate variables
  >> into data structures:
  >> use constant FG_COLOR => ( 253, 245, 230 );
  >> use constant BG_COLOR => ( 205, 192, 176 );
  >> use constant TRANSPARENT_COLOR => ( 255, 255, 255);

  MM> Again we are back to potatoes - potatoes - tomatoes - tomatoes.  (And
  MM> if you don't understand what I'm saying it's the old song called
  MM> "Let's call the whole thing off".

  >>> $fg = $a->colorExact( $fg_r, $fg_b, $fg_b );
  >>> $bg = $a->colorExact( $bg_r, $bg_b, $bg_b );

moron - maroon. 

there is a bug in those two calls. if you had used sinan's constant
suggestion you wouldn't have the bug. but since you behaved so nicely
(NOT!) i won't tell you what the bug it. and it could fix your problem
with gd but it won't fix the problem with you.

  >> Proper whitespace and indentation help others to understand your code.

  MM> Can't make Netscape change how it sends things.

but you can fix the overall formatting which is piss poor. even netscape
won't line wrap the way you did. but you know better, gd is buggy and
your code reads well to you. i say gd works, your code is buggy and
reads poorly to others. and i say that with love for perl and having
written and read a few lines of perl.

  >> Don't hesitate to use a pretty-printer if you lack the discipline to
  >> properly format your code.

  MM> Oh GACK!  You're being an ass.  Go away.

pot meet kettle. he didn't call you any names. you post code here, you
get code reviews which don't pull punches. your ego and weak perl skills
can't support you here.

  MM> Next time try focusing on helping people rather than trying to
  MM> beat them into the ground with your baseless accusations and
  MM> blathering.

next time you want help here you won't get it. too bad.

  MM> Did I mention you're being and ass?

you did several times. did i mention your code sucks? oh i did, several
times. note that i didn't insult you (well, i did call you a maroon
kettle!) but i did insult your code. professionals (in any field) can
discern the difference and take the feedback properly. try to learn how
to do that.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Sun, 26 Feb 2006 01:21:19 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: A Problem With GD
Message-Id: <x7lkvy7i8w.fsf@mail.sysarch.com>

>>>>> "ASU" == A Sinan Unur <1usa@llenroc.ude.invalid> writes:

  ASU> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in 
  ASU> news:Xns9775D249BB0BCasu1cornelledu@127.0.0.1:

  >> Mark Manning <markem@airmail.net> wrote in
  >> news:1201gn750d926e1@corp.supernews.com: 
  >> 
  >>> Ok - here ya go!  :-)
  >> 
  >> Well, OK, so I rearranged your script a bit

  ASU> Obviously wasn't worth it.

well, you fixed the bug that i spotted. :)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Sun, 26 Feb 2006 01:24:59 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: A Problem With GD
Message-Id: <x7hd6m7i2s.fsf@mail.sysarch.com>

>>>>> "S" == Sisyphus  <sisyphus1@nomail.afraid.org> writes:

  S> #my $fg_r = 253; # Foreground -> Red
  S> #my $fg_g = 245; # Foreground -> Green
  S> #my $fg_b = 230; # Foreground -> Blue
  S> #my $bg_r = 205; # Background -> Red
  S> #my $bg_g = 192; # Background -> Green
  S> #my $bg_b = 176; # Background -> Blue

  S> my $fg_r = 168;
  S> my $fg_g = 163;
  S> my $fg_b = 153;
  S> my $bg_r = 136;
  S> my $bg_g = 128;
  S> my $bg_b = 117;

  S> $fg = $b->colorExact( $fg_r, $fg_b, $fg_b );
  S> $bg = $b->colorExact( $bg_r, $bg_b, $bg_b );

  S> Like you, I find that if I use the values that are commented out
  S> (they're the values you used for for the first image files), then
  S> there's no problem.  But if I run that script as is (using the
  S> values you used for the second image files), I get those extra
  S> lines of extra dots in the gif file. So ....  the strangeness you
  S> report is dependent upon the values that are given to $fg_r, $fg_b,
  S> $fg_g, $bg_r, $bg_b, and $bg_g ... and probably upon something else
  S> as well ... but I don't know what :-)

you have the same bug as the OP. and your values do affect the bug's
visibility (in both the code and other sense of that word). this is a
big hint as to the actual bug. note that sinan's code didn't show the
problem as he didn't have this bug.

and i just won't point it out due to the OP's attitude.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Sun, 26 Feb 2006 12:54:17 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: A Problem With GD
Message-Id: <Xns977650834F715asu1cornelledu@127.0.0.1>

Uri Guttman <uri@stemsystems.com> wrote in 
news:x7lkvy7i8w.fsf@mail.sysarch.com:

>>>>>> "ASU" == A Sinan Unur <1usa@llenroc.ude.invalid> writes:
> 
>   ASU> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in 
>   ASU> news:Xns9775D249BB0BCasu1cornelledu@127.0.0.1:
> 
>  >> Mark Manning <markem@airmail.net> wrote in
>  >> news:1201gn750d926e1@corp.supernews.com: 
>  >> 
>  >>> Ok - here ya go!  :-)
>  >> 
>  >> Well, OK, so I rearranged your script a bit
> 
>   ASU> Obviously wasn't worth it.
> 
> well, you fixed the bug that i spotted. :)

;-)

To clarify for the benefit of others: I am particularly sensitive to 
claims of library or Perl bugs which are made (a) without supporting 
evidence  (see OP's first post); or (b) are based on buggy code. If one 
is going to make such a claim, one needs to provide a test case that has 
obvious problems.

In making such a claim, one has to go beyond just making the code strict 
and warnings clean. This requirement is not baseless. Authors of 
libraries are probably getting a lot of bug reports from people whose 
first instinct is to blame someone else rather than fix problems with 
their own code. I appreciate those library authors.

Unfortunately, according to the OP, "a very nice person" helped the OP 
file a bug report already, so the authors' time will be wasted anyway.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



------------------------------

Date: Sun, 26 Feb 2006 08:09:45 -0500
From: "sinister" <sinister@nospam.invalid>
Subject: Sigils
Message-Id: <HPydnRPV2-0_NZzZRVn-ig@comcast.com>

I'm using perl5, not perl6.

Does anyone know a pointer to an essay on perl's sigils?  I've got the Camel 
book, which goes over these things, but I'm looking for a discussion of the 
general rationale.  That is, a more abstract set of rules that would allow 
me to interpret sigils without looking up meaning on a case-by-case basis.

One example:  what general principle would allow one to interpret
    %$a
conclude that
    $array[1]
is correct but
    @array[1]
isn't, and so forth.

TIA,

S 




------------------------------

Date: Sun, 26 Feb 2006 13:22:59 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Sigils
Message-Id: <Xns97765560D50C9asu1cornelledu@127.0.0.1>

"sinister" <sinister@nospam.invalid> wrote in
news:HPydnRPV2-0_NZzZRVn-ig@comcast.com: 

> Does anyone know a pointer to an essay on perl's sigils?  I've got the
> Camel book, which goes over these things, but I'm looking for a
> discussion of the general rationale.  That is, a more abstract set of
> rules that would allow me to interpret sigils without looking up
> meaning on a case-by-case basis. 
> 
> One example:  what general principle would allow one to interpret
>     %$a

%$a is a hash, therefore $a must be a reference to a hash,

> conclude that
>     $array[1]
> is correct but
>     @array[1]
> isn't, and so forth.

A specific element of an array is a scalar, so $array[1] is correct, and 
@array[1] is not.

Have you actually considered reading the docs available on your system?

perldoc perldata

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8996
***************************************


home help back first fref pref prev next nref lref last post