Professional and Affordable Web Design
0800 080 5401
Live photo blurring script - faces, number, plates, etc
In our recent project we came across a need for a script that will blur out part of an image. This feature is mostly needed to make people faces blurred out - but also to remove any personal data, like licence plate numbers, etc. We wanted our users to have a smudge tool that would works exactly like in Photoshop, but in their browser. Unfortunately, as it turns out, it is way too much to ask for from Java Script, and even if we would succeed in adding such a feature, it would most likely work really slowly.
At this moment we were left with two options – use Adobe Flash or Java Script with PHP.
And as we try to avoid Flash as much as possible, we went for the second one.
Our solution is pretty simple – we are using ImageMagick that is being executed by PHP. The blurring itself takes place on the server, but full control of it is through browser. On the client side we have Java Script that allows user to select region that he wants to blur out, and then when user confirms by clicking on a link an AJAX message is sent to the PHP script, containing coordinates of user's selection.
On the browser side we used jQuery with a very nice plugin called imgAreaSelect that allows user to select rectangle-shaped area of image for bluring out. It took us a while to find the blur command for ImageMagick that would blur out only part of the image.
Here is the code for blurring:
Another way to make some part of an image less recognisable is to pixelate it, you can use following command for that:
Of course you should change inputImage, outputImage filenames and coordinates (x1,x2,y1,y2) to match your requirements. In our example coordinates are passed through GET by AJAX query. The full PHP part of the script should look like following:
All comments are moderated for spam and will not be shown. All genuine comments wil be show, however the links will be based on a NO FOLLOW RULE. Repeat commenters adding value to the articles and discusions will have removed alowing Follow Rule to Work.
Make a Comment
See Full Portfolio Some Of Our Work
Driving Schools Booking Service (DSBS) is a network of driving instructors, covering the whole of the UK. For this project, we were...
County Security is a fully featured E - commerce solution, with an integrated "system configurator", which allows users to choose...
Customer News & Resources
At Mutiny Design we are constantly gathering together articles and help guides to assist our clients.Introduction to sitemap.xml
Checking for a sitemap A site map (or sitemap) is a list of pages of a web site accessible to crawlers or users. It can be either a document in any form used as a planning tool for web design, or a web page that lists the pages on a web site, Some developers feel that site index is a more appropriately used term to relay page function, web visitors are used to seeing each term and generally associate both as one and the same. However, a site index is often an A-Z index that provides access to content, while a site map provides a general... Read More »Center a web page in CSS
One simple way to center a web page using CSS is to create a container div, that is horizontally centered by having its left and right margins set to auto. Using this method, you can still apply colours / background images to the body tag, so its a flexible solution. (if you didnt need this ability, just apply margins and width to the body tag instead, and forget using the container div). The container div has the same width as your webpage and, well, contains it. All the code for your web page is placed inside the container div. This will... Read More »