#!/usr/bin/perl print "hello!\n"; use Image::Magick; #используем модуль my($image, $x); #переменные $image = Image::Magick->new; #новый проект $x = $image->Read("IMG_7670.jpg"); #открываем файл convert_to_rgb($x, "", "", "IMG2.jpg"); exit; sub convert_to_rgb { my ($image, $temp_dir, $dir, $name) = @_; # I can find no way to take a CMYK source and convert to # RGB then save as JPG. # the best thing I can do is save as an RGB PNG on the local server # and reread the image then convert to jpg # in order not to add these junk PNGS to the source dir, put them in temp $image->Set(colorspace=>'RGB'); my $temp_file = $temp_dir . $dir . '/' . $name . '.png'; # write the PNG if ( my $x = $image->Write(filename=>$temp_file) ) { warn "$x" if $debug; } # read the PNG # @$image = (); # if ( my $x = $image->Read($temp_file) ) # { # warn "$x" if $debug; # } }