You are here

Přidat komentář

Rychlejší a kratší varianta v PHP
Online zmalovátor: https://hensl.tech/zlo.php


<?php

$im = imagecreatefrompng("Stresova-Zlomalovanka.png");
for($y = 0; $y < imagesy($im); $y++){
for($x = 0; $x < imagesx($im); $x++){
if((imagecolorat($im, $x, $y) & 0xFF) > 127){
imagesetpixel($im, $x, $y, 0xFFFFFF);
}
else{
imagesetpixel($im, $x, $y, 0x000000);
} } }
for($y = 0; $y < imagesy($im); $y++){
for($x = 0; $x < imagesx($im); $x++){
if(imagecolorat($im, $x, $y) == 0xFFFFFF){
imagefilltoborder($im, $x, $y, 0x000000, mt_rand(0, 0xFFFFFF));
} } }
imagepng($im, "zlo.png");