Page 1 of 1

How to force super sampling instead of EWA resampling for distort ?

Posted: 2015-09-23T08:14:15-07:00
by indiana
hi everybody,

I'm working on a web application and I need with PHP to distort and tile an image, just as :
http://www.imagemagick.org/Usage/distorts/#horizon

But with a small process time, I need to render with interpolated lookup or super sampling x3 ou 4, as :
http://www.imagemagick.org/Usage/distor ... a_vs_super

I can do this with inline command (convert ... -virtual-pixel tile -filter point -set option:distort:scale 3 -distort perspective ...), but I found nowhere how do to with IMagick !

My code :

Code: Select all

$echant=new Imagick();
$echant->readImage('texture.jpg');
$echant->resizeImage(800,600,Imagick::FILTER_CATROM,1);
$echant->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TILE);
$echant->setImageMatte(true);
$echant->setImageMatteColor('black');
$echant->setImageFormat('png');
$echant->distortImage(Imagick::DISTORTION_PERSPECTIVE, array( 0,0, 2,285, 354,0, 161,266, 354,532, 347,474, 0,532, 15,528 ), false);
I try VIRTUALPIXELMETHOD_BACKGROUND to see a result quickly (it's working) and with setImageProperty('filter:point','option:distort:scale 3') and/or setImageArtifact('filter','point') but nothing work.

Help needed and greatly appreciated ! Thank in advance.

Indy.

Re: How to force super sampling instead of EWA resampling for distort ?

Posted: 2015-09-23T09:02:23-07:00
by snibgo
I don't know IMagick. Perhaps it can't do "-set option:distort:scale 3".

A similar result comes from resizing the input up by 300% before distorting, and resizing down to the exact dimensions after. In my experiments, for a given factor, I find this gives a better quality than "option:distort:scale".

Re: How to force super sampling instead of EWA resampling for distort ?

Posted: 2015-09-23T22:36:25-07:00
by indiana
Ok thank you for the tip, but to do that I need to "-filter Point" with $echant->distortImage() and I don't know how...