is there any way to connect GIMP with PHP and use its libraries? It seems that all i do my development use linux as a production server example for resise image or croping
is there any way to connect GIMP with PHP?
1.1k views Asked by user2944496 At
3
There are 3 answers
0
On
I like the ImageMagick library, it is more powerful than the GD library. However it doesn't come pre-installed with php you have to do it manually, but if you can do it, it's easy to install with:
sudo apt-get install php5-imagick
The website: https://www.imagemagick.org
The PHP docs: http://php.net/manual/en/book.imagick.php
0
On
There is also the GD library which can be used with PHP directly.
http://php.net/manual/en/ref.image.php
imagecrop — Crop an image to the given rectangle
imagescale — Scale an image using the given new width and height
First thing: for resizing or cropping, you really should use some PHP library that integrates with Imagemagick, or something along that.
Now, to actually answer the question "is there any way to connect GIMP with PHP?" - The answer to that is "not directly".
Supposing you want to do extend use of Image manipulation algorithms for some serious project - GIMP engine nowadays is driven by GEGL (Generic Graphics Library) - which has support to binding with any other language through gobject introspection. Now,, gobject introspection can theoretically work with any language - but looking for Gobject Introspection for PHP yields some blog postos form 2011, and some early-stage projects on github. Therefore, although GEGL is what could provide you full image maniulation capabilities, I don't think it can be directly itegrated with PHP due to missing gobject integration. There should be a lot of ways of usig it indirectly, though - by creating some local web-service that would use GEGL to process operations described in XML, for example - such a service could be made in Python or C.
And, finally, for using GIMP's PDB itself, one could craft a Python script that would work as a local webservice relay to GIMP's PDB -so it is also possible in an indirect way.