Hi,

I am writing a Perl script to find a generic optimizing formula. Please
have a look:

=========================
            case /\.(gif|jpe?g|png)$/io { # An image
                my $image = new Image::Magick();
                my $last_error;
                $last_error = $image->Read($file);
                if ($last_error) {
                     print ($last_error);
                }
                else{ #image seams ok so we continue
                    (my $magick, my $colors, my $baseColumns, my
$baseRows) = $image->Get('magick', 'colors', 'base-columns', 'base-rows');
                    #print "format:".$format." ";
                    print "base-columns:$baseColumns x $baseRows";
                    print "magick: $magick";
                    print "colors: $colors";
                    switch ($magick){
                        case 'GIF'{
                            if ($filesizeBefore>6000){
                                # If GIF files are bigger than 6kb we
interleace them
                                # and we have a different blur
                                $image->AdaptiveBlur(Radius=>4);
                                #$image->Interlace('line');
                            }
                            else{
                                $image->AdaptiveBlur(Radius=>2);
                                #$image->interlace('none');
                            }
                            if ($colors>16){
                                my $reducedColor=$colors/2;
                                $image->Posterize(levels=>$reducedColor,
dither=>'False');
                                print "->$reducedColor\t";
                            }
                            $image->Quantize();
                            $image->Write($file);
                        }
                        case 'JPEG'{
                            system "jpegoptim -f $file";
                            #also test on packJPG
                        }
                        case 'PNG'{
                            system "optipng -q -o3 $file"
                        }
                    }
                }
                undef $image;
            }

=========================

Are there any good ImageMagick equivalent for: jpegoptim -f $file
...and/or... optipng -q -o3 $file ?

Thanks,

Bastiaan

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to