
cdsi_perl
newbie
Nov 14, 2001, 8:19 AM
Post #1 of 1
(678 views)
|
|
Resizing a generated barcode png
|
Can't Post
|
|
I am trying to resize a barcode image generated from GD::Barcode. Does any one have any idea on how to do this. Below is some sample code in my attempt to get this to work: use GD::Barcode; use GD; #binmode(STDOUT); $temppath = "/tmp"; $Code = "Code39"; $mediaid = "A0050"; my $oGDB = GD::Barcode->new("$Code", "$mediaid"); my $oGD = $oGDB->plot(NoText=>1, Height => 40); $myImage = new GD::Image(200,40); $png_data = $oGD->png; open (BC, ">/tmp/bcode.png"); print BC $png_data; close (BC); $myImage2 = GD::Image->newFromPng('/tmp/bcode.png'); $npng = $myImage->copyResized($myImage2,0,0,0,0,200,40,80,40); open open (BC, ">/tmp/bcode2.png"); print BC $npng; close (BC); #open(DISPLAY, "| display -"); #binmode DISPLAY; #print DISPLAY $npng; #close(DISPLAY); Thanks.
|