Bilder umfärben, z.B. rot/weiß
Hanna
- php
0 Hanna
Hallo liebes Forum,
kann ich mittels PHP JPG-Bilder umfärben?
Ich möchte aus bunten Bildern schwarz/weiß bzw. Rot/weiße Bilder machen ...
Danke für Eure Hilfe ..
Hanna
Hallo nochmal,
hab folgendes gefunden
for ($y = 0; $y <$pic_height; $y++) {
for ($x = 0; $x <$pic_width; $x++) {
# here we extract the green from
# the pixel at x,y , to use it as gray value
$gray = (ImageColorAt($image1, $x, $y) >> 8) & 0xFF;
# a more exact way would be this:
# $rgb = ImageColorAt($image1, $x, $y);
# $red = ($rgb >> 16) & 0xFF;
# $green = (trgb >> 8) & 0xFF;
# $blue = $rgb & 0xFF;
# $gray = (int)(($red+$green+$blue)/4);
# and here we set the new pixel/color
imagesetpixel ($image1, $x, $y, ImageColorAllocate ($image1, $gray,$gray,$gray));
}
das klappt auch in Graustufen ... wie kriege ich das in "Rotstufen hin" ... könnt Ihr mir helfen?
LG HANNA
Hi Hanna,
# $gray = (int)(($red+$green+$blue)/4);
Vielleicht versuchst Du mal, in dieser Zeile grün und blau wegzulassen?
Viele Grüße
Mathias Bigge