Browse Source

Add random line noise, adjust amount of static

tags/v0.2
Skylar Ittner 2 years ago
parent
commit
8cc0315cf7
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      api.php

+ 10
- 2
api.php View File

@@ -61,12 +61,20 @@ switch ($VARS['action']) {
imageSaveAlpha($img, true);
$black = imagecolorallocate($img, 0, 0, 0);
$white = imagecolorallocate($img, 255, 255, 255);
for ($i = 0; $i < 512; $i++) {
// Add static noise
for ($i = 0; $i < 150; $i++) {
imagesetpixel($img, mt_rand(0, 63), mt_rand(0, 63), $black);
}
for ($i = 0; $i < 256; $i++) {
for ($i = 0; $i < 75; $i++) {
imagesetpixel($img, mt_rand(0, 63), mt_rand(0, 63), $white);
}
// Add lines
for ($i = 0; $i < 2; $i++) {
imageline($img, mt_rand(0, 63), mt_rand(0, 63), mt_rand(0, 63), mt_rand(0, 63), $black);
}
for ($i = 0; $i < 5; $i++) {
imageline($img, mt_rand(0, 63), mt_rand(0, 63), mt_rand(0, 63), mt_rand(0, 63), $white);
}
imagepng($img);
exit();
case "verify":

Loading…
Cancel
Save