I am using both PHP imagick and PHP vips library for image operations. I am working on image resize operation. For imagick I am using resizeImage() function and for vips I am using resize() function. But the output of both the image are different for same height and width. I want to same output for vips. Here I add my code which I am using for vips. I want same result for vips also, which I got into imagick
<!-- Imagick Code -->
$img = new Imagick($ipFile);
$img->resizeImage(1000, 1000, Imagick::FILTER_LANCZOS, 1, true);
$img->writeimage($opFile);
<!-- VIPS Code -->
$im = Vips\Image::newFromFile($ipFile);
$im = $im->resize($ratio, ['kernel' => 'lanczos2']);
$im->writeToFile($opFile);


Don't use
resizewith php-vips unless you really have to. You'll get better quality, better speed and lower memory use withthumbnail.The
thumbnailoperation combines load and resize in one, so it can exploit tricks like shrink-on-load. It knows about transparency, so it'll resize PNGs correctly. It also knows about vector formats like PDF and SVG and will size them in the best way.Try:
Benchmark:
nina.jpgis a 6k x 4k RGB JPG image.resizetakes 390ms and 61MB of memorythumbnailtakes 160ms and 50MB of memoryQuality will be the same in this case.