Curious if anyone here has any experience with Image::Magick for Perl? The code in red does create a GIF file in the new dimensions, but it is blank, or should I say black. I know the $src handle is good, as I use it in the Thumbnail module and it works ok.

I tried using that same module to create my samller image, but it was so blurry. So I figured try the actual Image::Magick module, but really, the results are, well blank.

Thanks ahead....

my $src = new Image::Magick;
	$src->Read($ifilename);
	my ($thumb,$tx,$ty) = Image::Magick::Thumbnail::create($src,'75x100');
	$thumb->Write($tfilename);

	if(${%$info}{height} > 225 || ${%$info}{width} > 165)
	{
		my $reduce_by = 0;
		ONCEMORE:
		if(${%$info}{height} > 225)
		{
			$reduce_by = 225/${%$info}{height};
		}
		else
		{
			$reduce_by = 165/${%$info}{width};
		}
		
		${%$info}{height} *= $reduce_by;
		${%$info}{width} *= $reduce_by;
		goto ONCEMORE if(${%$info}{height} > 225 || ${%$info}{width} > 165);
		
		$src->Resize(width=>${%$info}{width}, height=>${%$info}{height}, blur=>0);
		$src->Write($nfilename);		
		zDebugOut("$reduce_by, ${%$info}{width}, ${%$info}{height}");
	}
	else
	{
		my $current_size = "${%$info}{width}" . "x" . "${%$info}{height}";
		my ($newpic,$nx,$ny) = Image::Magick::Thumbnail::create($src, $current_size);
		$newpic->Write($nfilename);
	}

In the end I used Scale only after realizing that Resize was wrong. Sorry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.