imagemagick - Perl Image::Magick Convert Format -


a few months ago installed image::magick on perl server, have unexpected behaviour..

after hours of research, i'm stuck on problem..

what i'm trying convert image .png .jpg.

there no problem here.. problem comes here. converted file ".jpg" large .png after conversion..

here snippet of code:

my $image = image::magick->new;   $x = $image->read($serverpathdir.'/'.$serverfilename);  # .png file       $x = $image->set( gravity => 'center' );     $x = $image->resize(geometry=>'435x210');      $x = $image->set(quality=>'80%');     $x = $image->write($serverpathdir.'/'.'.jpg'); 

after research , theory, realized such problem may exist in specific images.. when test other images, result more satisfactory nothing gimp (png jpg)... don't know compressor image::magick uses, seems different others.. ie: gimp

the problem may have png files compressed.

when convert format, have decompress image. compress in format, may not able compress as original format.
png's few colors can compressed more using color palette, containing colors used.

so quite find file jpeg version larger, if have large enough sample size.

you can read more on wikipedia.

i convert jpeg files larger arbitrary size, ( larger files more photograph. ) unless absolutely need use jpeg format. ( example program can't read png files )


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -