I need some PHP classes that deal with image processing in a good manner. I have made a thumbnail creator myself but the end result quality is just horrible.
Is it also possible to let PHP convert and save all images to one type. For example take an image(jpg,png,gif), compress it, resize it, and save as png.
Can anyone recommend some good classes for this.
Check out https://github.com/avalanche123/Imagine, given you use PHP 5.3, it will solve most of your image processing needs
You can take a look at this one
http://shiftingpixel.com/2008/03/03/smart-image-resizer/
You can look into the php gd library, or imageMagick, which has bindings for php.
If you have access to command-line i'd recommend image magic. The comman-line version has the advantage that it includes several features for batch processing.
Related
I have an image of NxN size and an image of MxM, with N>M. I want to place the second on top of the first, but I want to do it on a specific pixel e.g.(10,15)
I installed imagemagick and start playing with it cli (planning to try with php later), but I could not find if there is something that I could use for this purpose or if it is possible by combining some commands.
So my question(s):
Is something like this possible with imagemagick?
If yes, how could I achieve it in command line imagemagick?
If yes, how could I achieve it with imagemagick in php?
Expanding on my comment, I think php gd would be a good fit for this. PHP gd is better integrated into php and works better in my opinion. I use it for a host of things (resizing thumbnails most notably). Your question seems very similar to placing a watermark on an image, ie one image is place on top of another and it is exported as a single raster image. Here's a quick example for creating this watermark:
http://www.sitepoint.com/watermark-images-php/
This example exports it directly to the browser, but it can be easily modified to save the image locally to your file system. Enjoy!
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.
I'd like to know which up-and-crop tools you suggest to me. I tried couple of scripts like JCrop but I always get stack with some type of format like bmp. I either can't upload or I can upload but can't crop. If you use (or know) one that works well with different formats, then please just give me its name and I'll be strongly appreciated!
Well, i dont know much about JCrop but you can build it up with several tools.
I think image processing kind of works should be done on server side.
There is a good OOP Library called Imagine. It's mostly based on Python's Imaging Library which is awesome and has decent documentation. And this is its crop functions documentation.
On client side you can use some kind of image area selection tool to let the user determine desired area to crop. imgAreaSelect is good to go. Then you can send crop area to php by JQuery's post function or any other way.
It's amassing that in all this time this haven't got any other answers, I hope this helps.
Like stated in the other answer you should combine a few tools to solve each part of the problem.
To let the user select the cropping area:
If you don't like jCrop you can try Guillotine. It's very lightweight, easy to set up and allows to crop, zoom and rotate images. It has touch support and it's responsive (fluid).
Keep in mind that you can't display image types that the browser doesn't support, but you can convert them in step 3.
To upload the images:
For most cases, once you have the cropping area, with a simple file input will suffice.
Now, if you want to upload files asynchronously check out
this
for a quick and easy set up or this
for a more complex solution.
To actually crop and process the image:
Once uploaded you can crop, convert and process the images on the server, ImageMagick is a great tool for this. It's Open Source and many languages have wrappers for it.
You've tagged the question with PHP so here is a PHP wrapper for ImageMagick.
I am looking for a solid PHP thumbnail generating class. Does anyone know any good ones that are open-source?
I could write one, but I really don't want to. The one thing I hate most about PHP is manipulating images with GD and Imagemagick.
Does anyone have any suggestions?
Use phpThumb(). Its a script that internally uses GD library and/or ImageMagick (whichever is available and whichever it thinks is best for the job) to perform basic image manipulation tasks, including thumbnail generation and square thumbnail generation.
You can use it like this:
<!-- best fit -->
<img src="/phpThumb/phpThumb.php?src=/path/to/image.jpg&w=64&h=64">
<!-- crop fit (square thumbnails) -->
<img src="/phpThumb/phpThumb.php?src=/path/to/image.jpg&w=64&h=64&zc=1">
It has built in caching engine so second time a browser requests the above image it is served from its own cache instead of re-generating the thumbnail every time. Though, you may want to spend an hour or so configuring it.
use class.upload.php
see this link for details may be its help you more
http://www.verot.net/php_class_upload_samples.htm
Generating a thumbnail requires so little code that it is a "simple example" of the GD library's resizing functions in the manual:
http://php.net/manual/en/function.imagecopyresampled.php
Just copy and paste.
I am using php and I want to take a snapshot of my web page using php. Something similar to this
http://www.moneycontrol.com/gd/mail_indices.php
How can i do that?
To take Snapshots of a website, and not as proposed generate an image with text in it, you can use either
http://iecapt.sourceforge.net/ for snapshots using IE's rendering engine or
http://cutycapt.sourceforge.net/ for Webkit (Safari/Chrome) snapshots
I strongly recommend the latter.
The fastest and surest way in PHP to create images is to look at the GD Library. They have tons of functions to help you create your image easily.
Should you need a font that is available in Windows Font but not in PHP font, you can use this tool to convert it: http://www.wedwick.com/wftopf.exe
You can use Imagemagick.
Theres is a comprehensive summary of image creation option in Php here. The other option not already mentioned is Cairo.