Is there any basic (free or not), but usable - not like libpuzzle - image fingerprinting/similarity/compare module for PHP, which works akin to TinEye or Google image upload search? It's basically needed to avoid uploading almost the same (but with watermarks, resized etc.) image twice into a set of 50-300 images.
Take a look at http://www.intelliot.com/2008/03/sorted-directory-listing-image-resizing-comparison-and-similarity-in-php/
This is a very interesting educational article about image comparison. It wouldn't be hard at all to adapt to PHP using the GD library or ImageMagick.
http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html
Good luck !
Related
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 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.
User of my site upload images which are used as avatars. I have set a upload limit size of 2 MB. At most places I only require thumbnails. But users upload images with far bigger resolutions. I store these files on my file-system.
How can i create thumbnails and store them instead of large sized files?
Depending on your installation / server setup, you have several possibilities.
You could use the GD library, and something like its imagecopyresized function
Or you could use the Imagick extension, and something like its thumbnailImage method.
I would say that I've quite never seen a server without GD installed -- for Imagick, its less likely to be installed by default :-(
Another solution might be to call the convert command-line utility (it comes with ImageMagick -- independantly of any PHP extension), using something like exec to call it.
Advantage, with that, would be that you wouldn't be limited by memory_limit, as the resizing would be performed by an external tool -- but, of course, it also means that your application will rely on an external tool, which is not always nice...
If necessary, there are plenty of tutorials about GD ; for instance, those might interest you :
How to create thumbnails with PHP and gd : it uses a batch process to generate thumbnails for many images -- which might be useful if you have to generate thumbnails for all images that you already have
Thumbnail generation with PHP tutorial : does some stuff not often seen, like create square thumbnails, by centering the orignal image and adding some background color.
You can use the GD module or the ImageMagick module to resize and shrink any uploaded images.
If you google around for something like "PHP image resizer", you'll find lots of examples. I tend to use GD, as I have an old bit of code kicking around that works just fine. Assuming you have a known uploaded jpeg image found at $srcImgPath, you could do something like the following, where $newWidth and $newHeight are the new sizes of image you want:
list($width, $height, $type) = getimagesize($srcImgPath);
$srcImg = imagecreatefromjpeg($srcImgPath);
if ($srcImg === false) return false;
$workImg = imagecreatetruecolor($newWidth,$newHeight);
imagecopyresampled($workImg,$srcImg,0,0,0,0,$newWidth,$newHeight,$width,$height);
imagejpeg($workImg,$newFilename,$quality);
Functionalize as appropriate, and be sure to specify the $quality. You can abstract this code out to handle gifs and pngs very easily as well.
Check out the gd library, specifically the imagecopyresized function
Just a quick note, if you go down the GD route, use imagecopyresampled, as it produces cleaner looking images. By that I mean it won't look as grainy and/or pixely.
Link to the PHP manual on the function: http://us2.php.net/manual/en/function.imagecopyresampled.php
I would recomend the timthumb.php script. it is rock solid.
http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/
If you have Imagick installed in your PHP setup. Then there is a function that does this. Imagick::thumbnailImage()
If you don't have Imagick, then the GD library will come in handy. Since they have imagcopyresized()
Isn't Google AppEngine fitted with a subset of PIL? There is the 'resize' function that could be use... and best of all, you are getting a free quota!
i work in lamp environment .
i search script that know to take a image , that user upload to my site.
and make from this image , new image that contain the real image with small stamp on the top corner.
thanks
your best bet would be to look here it is an ideal script provided by the PHP.net user guide. Just make sure that you have the GD library installed
You'd want a watermark which can be accomplished with GD
What you are describing is "watermarking". There are tools out there to do this, a lot of image manipulation packages have this feature.
A search for this might lead you to something useful.
Have a look at these PHP tutorials:
Using imagecopymerge() to create a translucent watermark
Adding watermarks to images using alpha channels