Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

GD && EAN-13

by teamster_jr (Curate)
on Mar 28, 2006 at 13:22 UTC ( #539695=obfuscated: print w/ replies, xml ) Need Help??

Based on this. This uses GD to produce a more precise graphical output.
$_="JUST ANOTHER PERL HACKER,";use GD;$i=new GD::Image(113,350);$i->fi +ll (0,0,$i->colorAllocate(255,255,255));s#.{5}#$d=5;@a=($q=0,map{$d+=$f++ +%2 ?3*$_:$_;$_;}map{split//}unpack C5,$&);push@a,10-$d%10;@g=(3,5,23,join +( "",@a)=~/(.{6})/,63,$');$b=$i->colorAllocate(0,0,0);$t=9;map{$h=$q++%7 +? 50:60;$i->line(++$t,$y+9,$t,$y+$h,$_?$b:$w)for split//,/1/?$_.$i->stri +ng (gdTinyFont,shift@g,53+$y,shift@g,$b):do{$l=$z=unpack B7,pack v,unpack +(x .$_.C,"5A;eKYWc_3")-40<<1;$z=~s/./1^$&/eg;$m=reverse$z;${qw.l m m l l +m. [$c++%12]||z}}}101,splice(@a,0,6,"01010"),@a,101;$y+=70#eg;print$i->pn +g
The output should be piped into a png file thusly:
# perl ean-13.pl > out.png
enjoy.
al
ps. for those without GD, the image can be seen on my homenode

Comment on GD && EAN-13
Select or Download Code
Re: GD && EAN-13
by japhy (Canon) on Mar 28, 2006 at 17:39 UTC
    You're still doing $l = $z = ..., but I don't see where $l comes in. Is this simply a code-spacing device?

    Update: oops. I totally ignored the ${qw.l m m l l m.} part.


    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
      yep, these are the encodings. l is left hand odd, m is left hand even and z is right hand even. (rhe is the inverse of lho and lhe is the reverse of rhe).
      Of course i've now found EAN-128 which is varibale length and alphanumeric...
      maybe i'll get round to making one of them :)
      a

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://539695]
Approved by Limbic~Region
Front-paged by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2014-08-29 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls