I
I
Igor Samokhin2015-05-12 15:42:45
PHP
Igor Samokhin, 2015-05-12 15:42:45

How to rotate an image in PHP to an acute angle and have anti-aliasing at the edges?

Hello,
I have a task to rotate a png image by an angle of 2 degrees. But the edges when rotated by the imageRotate function are torn:

$dest = imagecreatefrompng($_SERVER['DOCUMENT_ROOT']."/images/female_big.png");
imagealphablending($dest, true);
imagesavealpha($dest, true);
$dest = imagerotate($dest, -2, IMG_COLOR_TRANSPARENT);
/*imagefilter ($dest, IMG_FILTER_SMOOTH, 100); - не помогает*/
imagepng($dest, "1.png");

I read that it is called Jaggies Effect stackoverflow.com/questions/11925909/removing-smoo... - but there is no normal solution.
Can someone at least be able to recommend a php library that can handle sharp corners? Or is this a bug in GD and should I use imagick?
b1ed37e8cdef476d89bd12ce87652801.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
matperez, 2015-05-12
@grigor007

So your link says that "GD uses very fast methods for all it's abilites without any actual smoothing or anything like that involved. If you want some proper image editing, you could either look into ImageMagick". Use Image Magic.
You can google something like "php image manipulation library" but things like that are slow in php. Most likely, all such libraries will work on top of gd or imagick.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question