Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: BMP: Drawing or photograph?

by zentara (Archbishop)
on Oct 29, 2012 at 10:28 UTC ( #1001337=note: print w/replies, xml ) Need Help??

in reply to BMP: Drawing or photograph?

PNG is better if there is written text, JPG is better for drawings and images. The best converter is ImageMagick.
# using the ImageMagick c program system( "convert my.bmp my png");
or using the Perl module, here is a generic conversion routine:
#!/usr/bin/perl use warnings; use strict; use Image::Magick; my $imgfile = shift; # your BMP file my $image = Image::Magick->new(); $image->Read($imgfile); my $blob = $image->ImageToBlob(); # make in memory image #and to convert my $output = Image::Magick->new(magick=>'jpg'); # set your output for +mat $output->BlobToImage( $blob ); $output->Resize(geometry=>'160x120'); $output->Write( "$0.jpg" ); #or if you want to write to stdout #binmode STDOUT; #$output->Write('jpg:-');

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001337]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2018-06-25 16:19 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (127 votes). Check out past polls.