[GD] Regenbogenschrift

blackdrake

Grünschnabel
Hallo. Ich möchte eine Regenbogenschrift machen. Ich habe jedoch 2 Probleme

a) Die Schrift ist verwaschen (sieht zwar gut aus, aber in meinem Beispiel ist es schlecht)
b) Ich schaffe es nicht, Bild A und Bild B zu Bild C zusammenzufügen.

Meine Vorgehensweise:

- Bild A erstellen mit weißem Hintergrund und transparenter Schrift
- Bild B erstellen mit Regenbogenfarbe (im Moment nur rot)
- Bild A auf B legen und beide zu C verschmelzen
- Bild C transparent machen

regen.GIF


Der Code:

Code:
<?php

header('Content-type: image/png');

$font_im = imagecreate(250, 250);

$white = ImageColorAllocate($font_im, 255, 255, 255);
$blue = ImageColorAllocate($font_im, 0, 0, 255);

imagettftext($font_im, 26, 0, 10, 30, $blue, 'font.ttf', 'Test');
imagecolortransparent($font_im, $blue);

$color_im = imagecreate(250, 250);
ImageColorAllocate($color_im, 255, 0, 0);

imagecopyresampled($color_im, $font_im, 0, 0, 0, 0, 250, 250, 250, 250); // Bild A soll nicht nur auf Bild B gelegt werden; sie sollen zu Bild C verschmolzen werden

// Bild C wird transparent gemacht

imagepng($color_im);

imagedestroy($color_im);
imagedestroy($font_im);

?>

Zu Problem b: Wenn ich jetzt bei dem unverschmolzenen Bild die Transparenzfarbe auf weiß stellen würde, würde der rote Hintergrund vom "Regenbogen"-bild durchscheinen.

Ich nutze Tahoma fett als font.ttf.

Kann mir jemand helfen?
 
Zurück