Jump to content

Can PHP do all of this image manipulation?


galvin
Go to solution Solved by requinix,

Recommended Posts

I have been tasked with attempting to recreate a web app that allows a user to upload a photo and then cut out a specific part of an image that will be saved as a transparent PNG, with the main use being removing backgrounds from an image (i.e. cutting out a face to use as an avatar, etc)

 

I found two online tools that already do this in different ways:

 

1.  Smart Scissors:  

 

Quick video shows how you can drop anchor points with your mouse and it will try to auto find the border and "snap to". Pretty slick but doesn't work perfectly when I played with it.  And requires a separate "invert" option to handle all scenarios.

 

http://fotoflexer.com/demos.php 

 

 

2. Clipping Magic:  

 

This one is very cool and surprisingly accurate. You basically paint rough green lines over the stuff you want to keep and red lines over the stuff you want to cut out and a live preview lets you see the result.

 

https://clippingmagic.com/tutorials/basics

 

 

I am not asking for anyone to give me any code whatsoever, just curious, do you think both of these types of things are doable strictly using PHP (using GD and maybe some other custom PHP classes floating around the web)?

 

Are you able to tell what they both use now?  Actually looks like Smart Scissors uses Flash, but not sure about Clipping Magic.

 

I ideally would make something more like Clipping Magic.  I just don't want to start building in PHP if there are things that some of you smarter people on this site can tell I will never be able to accomplish using solely PHP, even if I was the best PHP developer ever. :)

 

Any info, direction, advice would be greatly appreciated.

 

Thanks!

 

Link to comment
Share on other sites

  • Solution

Using strictly PHP and GD? Well yeah, sure it's possible, but here are all the GD functions available to use and none of them do what you want. Meaning you'd have to do the edge detection* or masking yourself.

 

Bite the bullet and use something like ImageMagick instead. It does come as a PHP extension but more commonly you invoke the command-line program. It's powerful and I'm sure it can at least do the second method, if not both.

 

* GD can do edge detection, where it creates an image showing edges, but it won't work for arbitrary points on an image so you couldn't rely on it.

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.