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']) {
61 61
         imageSaveAlpha($img, true);
62 62
         $black = imagecolorallocate($img, 0, 0, 0);
63 63
         $white = imagecolorallocate($img, 255, 255, 255);
64
-        for ($i = 0; $i < 512; $i++) {
64
+        // Add static noise
65
+        for ($i = 0; $i < 150; $i++) {
65 66
             imagesetpixel($img, mt_rand(0, 63), mt_rand(0, 63), $black);
66 67
         }
67
-        for ($i = 0; $i < 256; $i++) {
68
+        for ($i = 0; $i < 75; $i++) {
68 69
             imagesetpixel($img, mt_rand(0, 63), mt_rand(0, 63), $white);
69 70
         }
71
+        // Add lines
72
+        for ($i = 0; $i < 2; $i++) {
73
+            imageline($img, mt_rand(0, 63), mt_rand(0, 63), mt_rand(0, 63), mt_rand(0, 63), $black);
74
+        }
75
+        for ($i = 0; $i < 5; $i++) {
76
+            imageline($img, mt_rand(0, 63), mt_rand(0, 63), mt_rand(0, 63), mt_rand(0, 63), $white);
77
+        }
70 78
         imagepng($img);
71 79
         exit();
72 80
     case "verify":

Loading…
Cancel
Save