2

Im trying to make an algorithm to find images without watermarks in a specific site. I have found a pattern in the images I can go after as you can see in the images below, the text "Store No" which is always in white and always in the same position in the images.

How would you do this? To make it as foolproof as possible it would be nice to check as many pixels as possible, so it will not be ideal to hardcode the pixels to check by hand. Maybe make another image in the same size, "extract" the "Store No" bit, make the background black, then get the white pixelpositions with PHP?

Any hints to how I could go about this would be of great help!

enter image description here enter image description here

Anand Somasekhar
  • 596
  • 1
  • 11
  • 20
Kristian Rafteseth
  • 2,002
  • 5
  • 27
  • 46
  • Create an alorithm - check few pixels - every pixel matching the color white shall be 1 point and every pixel that doesn't match white in position other than the watermark shall be as well a point - at the end count points. ;) But how to help You with checking single pixel i don't know. I would open file via fopen and display it's insides - if not i would try to have fun with IMAGICK :) – Mr.TK Mar 18 '14 at 06:33
  • see this , it might help you http://stackoverflow.com/questions/15339864/php-detecting-watermarked-images – Dimag Kharab Mar 18 '14 at 06:35

1 Answers1

1

You can use imagecolorat(),

Example from php manual :

int imagecolorat ( resource $image , int $x , int $y )

$im = imagecreatefrompng("php.png");
$rgb = imagecolorat($im, 10, 15);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
var_dump($r, $g, $b);

-- And of course you must have GD library installed

Alireza Fallah
  • 4,609
  • 3
  • 31
  • 57