How to cut a seam on an image using the PHP GD library?

I am working on a project that resizes images using the PHP GD library . I would like to add the ability to use seam cutting to resize images, but I do not want to require something like ImageMagick (which can perform seam cutting using the liquid scaling function ) to do this.

Since there are no built-in thread functions in GD, is there a way to perform image threading using the PHP GD library or other built-in PHP functions? Alternatively, did you know that cutting seams will eventually be baked in GD?

+4
source share
2 answers

While you can implement this with GD, it is best to control if you can manage the server environment to create an external script / program to crop the image. PHP will be a huge bottleneck performing such calculations. Even basic matrix transformations pose a serious risk of getting the maximum execution time specified in PHP configurations.

+2
source

I do not understand why this is not possible with GD, but I can say that it will be slow.

Imagemagick is open source, so I think you could translate the function into PHP.

0
source

Source: https://habr.com/ru/post/1277628/


All Articles