Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this effect possible with php code, without special software

Tags:

php

graphics

I've learned to never underestimate what PHP and some libraries can do, so for this paper effect, can it be done with a php graphics library (or at least programmatically) without needing something like Photoshop or Illustrator?

To be clear, I'm asking just about the paper, not the iphone.

Edit: Dan Grossman's answer is great. I'm also wondering if someone can give me algorithmic ideas what might be happening in this image so I could try to possibly come up with some code to map it mathematically. My visual imagination is failing me a little.

enter image description here

like image 462
samquo Avatar asked Jun 01 '26 18:06

samquo


1 Answers

The answer is always yes, it's just a matter of difficulty/complexity.

PHP is a Turing-complete language, which means it has equal capabilities of every other Turing-complete language, like C++/Java or whatever your photo editing program was written in.

That means whatever Photoshop does, you can do. If nobody has written a handy library, you can treat the image as a matrix and perform the mathematics necessary to get the desired warping, then write the resulting matrix of pixel information to a new image one pixel at a time as a bitmap.

Of course you weren't hoping for that answer, you meant "does someone provide an easy library for PHP to do effects like this with a couple prewritten commands", right?

That's a little much for PHP's GD library, but you can always shell out to a command line image processor, like imagemagick, and read the resulting file to send back to the browser.

like image 66
Dan Grossman Avatar answered Jun 04 '26 07:06

Dan Grossman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!