Converting an image into a cartoon using php image magick - php

Im wondering does anyone know of any good tutorials that can help me learn to convert a human image to a cartoon using php image magick.
I have found this link, http://www.fmwconcepts.com/imagemagick/cartoon/
but there are two issue.
I'm not overly impressed with the results, I would imagine theres room for improvement
The script isnt PHP , but perhaps Ill have to learn to convert it myself and work from there.
I have another cartoonize class written in php that doesnt use image magick, but the results arent great, and I prefer image magick as it seems cleaner and faster.
Thank you

You can run bash shell scripts containing Imagemagick commands from PHP exec().
You might like this approach better, but I have no idea how they do it. See http://cartoon.pho.to/

Related

Getting PDF color in PHP

I am trying to make project of a web app that will check the colour of the PDF document. My preferred language is PHP.
At the begining I've been thinking about GD, but this only refer to images (jpg, png, gif). Nothing for PDF. For images I am going to use some method similar to this: Get image color.
So does anyone know some method, library (opensource), or something else to make such app? I can't find any examples on the web.
You'll probably be best off converting the PDF into an image, and then using the same method you're using for images. In addition to being easy to do, that will also guarantee consistent results.
However, converting a PDF file to an image is not something that PHP alone is well-equipped to do. The best way to go is the ImageMagick based approach as described in this question. It gives a number of alternatives, too.

PHP-based image processor that can be fed uploaded images?

Is there some kind of software that I can feed uploaded images to and have it process them to give back to me? This question is based off of this question, where one of the answerers told me to use some kind of processor that I could feed images to, but he did not know one that was good. Are there any programs like this?
PHP has GD built in. Check out some of the functions in that link. Hope this is what you're looking for.
As Jebego said, GD is good and will do almost all of what you could possibly need.
And ImageMagick does everything that you could possibly need, but is slightly harder to use.
However I think the answer to your other question is bogus, and possibly leading you down the wrong path.

php mosaic script

I'm using a script that I downloaded from google code to dynamically generate mosaic images with the GD library. The script seems a bit convoluted. I've messed around with it quite a bit, but I'm sort of confused since it's written in German and I don't speak deutsch. I know that in order for it to work, I need to have 121 different images. But, I'm not sure if they needs to be in the directory or in mysql. Does anyone have a clue as to how to use this? Or does anyone have some suggestions for a better script for generating mosaic images with the php GD library?
The script can be found here: http://code.google.com/p/phpmosaic/
Thanks,
Lance
The images you like to use as thumbnails have to be inside a directory. You must add them to the db using the methods
phpMosaicImageParser::parseImageFolder() or
phpMosaicImageParser::parseImage()
However: there is no fix number of required thumbnails, it will depend on the SourceImage and the used options how much thumbnails you'll need at least.

Require a PHP Image Resizer/Cropping Script

I am grabbing links to images and need to convert them on the fly to 72x108 to display on a website. The source images come from various resolutions, so cropping is required.
I know a moderate level of PHP so I can probably make something work for my needs, but was hoping for something that could be called by a url request. EG: mysite.com/thumbnail.php?src=http://anothersite.com/image.jpg&w=72&h=108
That would be ideal, it needs to support jpg/png.
Thanks in advance!
Here is a really handy script for processing and uploading images that's been a top google result for forever. I used it years ago and it was really easy to implement. Looks like it was just updated a couple weeks ago too :)
http://www.verot.net/php_class_upload.htm
This may be overkill, but if you check out the examples you can see there's a lot you can do with it. If you don't use it for this project, it might be worthwhile to try out for the next one.
just read the image from the url with file_get_contents or using curl and use the php gd library to resize and crop the image as per your needs.
Go through the following links for more info:
http://php.net/manual/en/function.file-get-contents.php
http://php.net/manual/en/book.image.php
http://davidwalsh.name/download-urls-content-php-curl

Is this effect possible with php code, without special software

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.
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.
Imagemagick has plenty of distortion methods which will help you get to where you want. However with the detail you've given you'll need to do the math yourself to work out the correct combination of distortions to get the page curl you're after

Categories