Gerade sind mir noch Fehler in der ersten Schleife aufgefallen.
Hier der korrigierte Code:
$Bild = "../GRAFIKEN/SORTIMENT/GewandungMuetzen3.png";
Koordinaten_ermitteln ($Bild);
function Koordinaten_ermitteln ($Bild)
{
$Bild = imagecreatefrompng ($Bild);
$Breite = imagesx ($Bild);
$Hoehe = imagesy ($Bild);
$Halbes_Bild = round ($Breite / 2);
for ($x = $Halbes_Bild + 1; $x < $Breite; $x++)
{
for ($y = 0; $y < $Hoehe; $y++)
{
$RGBA_aktueller_Pixel = imagecolorat ($Bild, $x, $y);
$Farbe_aktueller_Pixel = $RGBA_aktueller_Pixel["alpha"];
if ($x < $Breite - 1)
{
$RGBA_naechster_Pixel = imagecolorat ($Bild, $x + 1, $y);
$Farbe_naechster_Pixel = $RGBA_naechster_Pixel["alpha"];
}
else
$Farbe_naechster_Pixel = false;
if ($Farbe_aktueller_Pixel != 0 && ($Farbe_naechster_Pixel && $Farbe_naechster_Pixel == 0))
echo $x . ", " . $y . "<br>";
}
}
for ($x = 0; $x < $Halbes_Bild; $x++)
{
for ($y = 0; $y < $Hoehe; $y++)
{
$RGBA_aktueller_Pixel = imagecolorat ($Bild, $x, $y);
$Farbe_aktueller_Pixel = $RGBA_aktueller_Pixel["alpha"];
$RGBA_naechster_Pixel = imagecolorat ($Bild, $x + 1, $y);
$Farbe_naechster_Pixel = $RGBA_naechster_Pixel["alpha"];
if ($Farbe_aktueller_Pixel != 0)
echo $x . ", " . $y . "<br>";
else
if ($Farbe_aktueller_Pixel == 0 && $Farbe_naechster_Pixel != 0)
echo ($x + 1) . ", " . $y . "<br>";
}
}
}