Blurry Perspective

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
tolek
Posts: 1
Joined: 2017-02-08T01:47:04-07:00
Authentication code: 1151

Blurry Perspective

Post by tolek »

Hi,

I have a problem with DISTORTION_PERSPECTIVE for some images I got blurry efect like here:
http://nkontent.pl/imagick/pic.jpg

I tried many different ways to avoid this bug, but still same issue.
Maybe Im doing something wrong?

My code is:

$h = $img->getImageHeight();
$w = $img->getImageWidth();

$img->setImageMatte(true);

$r = 0;
$pers = 20;
$k = $w * $pers * 0.01;

$controlPoints = array(
0, 0, 0, 0,
0, $h, 0, $h,
$w, $r, $w, $k,
$w, $h, $w, $h - $k);

$img->distortImage(Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true);
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Blurry Perspective

Post by snibgo »

I have moved this to the Users forum.

The "blurry effect" in triangles at the top and bottom are from virtual pixels. Output pixels in these areas come from outside the input image. By default, pixels from the edge are used, hence the smearing effect. Set virtual pixels to black, or one of the other settings.
snibgo's IM pages: im.snibgo.com
Post Reply