Reputation: 1391
I want it to be like this:
But I am getting this:
<?php
$image = new imagick( $_SERVER['DOCUMENT_ROOT']."/test/op.jpg" );
$points = array(
90,
);
$image->setimagebackgroundcolor("#fad888");
$image->setImageVirtualPixelMethod(\Imagick::VIRTUALPIXELMETHOD_BACKGROUND);
$image->distortImage(\Imagick::DISTORTION_CYLINDER2PLANE, $points, true);
header("Content-Type: image/jpeg");
echo $image;
Upvotes: 1
Views: 242
Reputation: 42715
You want to use the wave filter, not the distortion filter.
<?php
$image = new Imagick("googlelogo_color_272x92dp.png");
$image->setImageBackgroundColor("#fad888");
$image->setImageVirtualPixelMethod(\Imagick::VIRTUALPIXELMETHOD_BACKGROUND);
$image->waveImage($image->getImageHeight() / -2, $image->getImageWidth() * 2);
header("Content-Type: image/jpg");
echo $image->getImageBlob();
You'll need to trim the image to remove the extra space added at the bottom. Output:
Upvotes: 1