Image::Xbm2bmp
Image::Xbm2bmp - for converting image file from XBM to BMP.
use Image::Xbm2bmp;
#Create a object from a xbm file
my $obj = Image::Xbm2bmp->new("/tmp/test.xbm");
#Create a object from array data
my $xbm_width = 32;
my $xbm_height = 24;
my @xbm_data = (
0x7c,0x3c,0x7c,0x3c,
0xfe,0x7c,0xfe,0x7c,
0xee,0xee,0xee,0xee,
0xe0,0xee,0x60,0xee,
0x70,0xfe,0x30,0xfe,
0x38,0xec,0xe0,0xec,
0x1c,0xe0,0xee,0xe0,
0xfe,0x7e,0xfe,0x7e,
0xfe,0x3c,0x7c,0x3c
);
my $obj = Image::Xbm2bmp->new();
$obj->load_xbm_data(\@xbm_data,$xbm_width,$xbm_height);
#Save as a BMP file
$obj->to_bmp_file("/tmp/test.bmp");
#Or get a packed data
my $packed_data = $obj->to_bmp_pack();
open(FILE,">/tmp/test.bmp");
print FILE $packed_data;
close(FILE);
#In CGI script
print "Content-type: image/bmp\n\n";
print $obj->to_bmp_pack();
XBM is a simple image format,we can show a dynamic picture easily via it,so some CGI use xbm file,but it can't be used in browser at WindowsXP(sp2),so we need a module to converting it.
None by default.
huang xin hx1978@hotmail.com
perl.