Mikedowney.co.uk
What's New
Site Map

Diary
Astronomy
Bits N Bobs
Computing
Food And Drink
Links
Photography
Welcome


Selected Entries
Pinhole Photography
Keeping Quail
Coventry
Recipes
Friends websites
A list of pet related websites
Celebrity Stiffs League

Most popular clicks
Coventry
Hamsters
Pinhole
Shopping
Food And Drink
Bits N Bobs
Astronomy
Humour
Birmingham
Animals


RSS Feeds:
RSS Feed Entire Site.
RSS Feed Diary only.


Advanced Search


Powered by Blosxom


Pinhole Photography Ring
pinhole webring logo
powered by RingSurf
Next | Previous
Random Site | List Sites

Trying to prevent image theft 2: Watermarking images

Story location: Home / computing /
14/Apr/2008

Yesterday I mentioned using the .htaccess file with Apache to prevent people hot-linking images. That would only be a temporary solution, which would stop current hot-links from working. Any future image theft would involve people downloading images and re-uploading them somewhere else.

One way of stopping that is to add a watermark to each image. There are a lot of websites explaining how to do that manually in Photoshop or Gimp, but I needed a simple way of adding a watermark to several hundred images.

I had heard about Image Magick and thought it might have a way of doing it. There are instructions here explaining how to do it.

The images on my website are spread across a lot of directories, so I wrote a small perl script to watermark all the images in a directory (including subdirectories):

#!/usr/bin/perl
# use ImageMagick to add copyright watermark to images

use File::Find;
use strict;

my  = "jpg|png";    # file extensions to apply watermarks to
my /computing = "/images";      # directory holding the images
my  = "/copyright3.png";    # full path to watermark image

sub processFile{
    return if ($_ !~ /.*\.[]/);
    my  = ::name;

    `composite -dissolve 10% -tile  "" ""`;
}

find(\&processFile,/computing);

The /computing and `` variables should hold the full path for the directory and watermark file. You'll need to produce an image with a transparent background for the watermark.

Changing the 10% value gives a ligher or darker watermark, depending on how obvious you want it to be.


0 comments, click here to add the first permanent link
Keywords:   

Leave a comment...

 
Name:
URL/Email: [http://... or mailto:you@wherever] (optional)
Subject: (optional)
Comments:
How many animals?

Type in how many animals you see.
This is required to verify
that you are an actual human
to reduce 'comment spam'.
Type in how many animals appear in the image. Sorry, this does not work without the image being visible  



Streamline.Net The home of good value web hosting