thecreep: PHP GD ImageResize - fehlehafte Farben

Hallo Leute,
ich habe einen kleinen Script geschrieben, der mir anhand einer URL eines JPEG-Bildes und entweder Breite oder Höhe, eine Thumbnail ausgibt. Ich berechne die jeweils nicht gegebene Dimension aus dem Seitenverhältnis des Originalbildes, soweit funktionierts auch noch einwandfrei. Dann tu ich das Bild per imagecopyresized skalieren und dann gebe ich es aus.
Nun ist leider das Problem, dass die Farbwerte irgendwie unnormal sind :(

hier ist mein Quelltext:

<?php  
//SPÄTER SIND DAS HIER PARAMETER  
  $PICTURE="./picture.JPG";  
  $HEIGHT=150;  
  
//QUELLBILD LADEN  
  $oldimage = imagecreatefromjpeg($PICTURE);  
//SEITENVERHÄLTNIS BERECHNEN  
  $is = getimagesize($PICTURE);//0=width,1=height  
  $Ratio=$is[0]/$is[1];  
//DIE NICHT GEGEBENE DIMENSION BERECHNEN  
  if($WIDTH)  
    $HEIGHT=$WIDTH/$Ratio;  
  elseif($HEIGHT)  
    $WIDTH=$HEIGHT*$Ratio;  
//DAS NEUE BILD ERZEUGEN	  
  $image= imagecreate($WIDTH,$HEIGHT);  
//QUELLBILD SKALIERT IM NEUEN BILD SPEICHERN  
  imagecopyresized($image,$oldimage,0,0,0,0,$WIDTH,$HEIGHT,$is[0],$is[1]);  
  
//BILD AUSGEBEN  
  Header('Content-Type: image/jpeg');  
  imagejpeg($image, NULL, 100);  
//RESSOURCEN VERNICHTEN  
  imageDestroy($oldimage);  
  imageDestroy($image);  
?>

So damit ihr wisst was ich wirklich meine das Originalbild und anschließend das Ergebnis:
http://tdv.td.ohost.de/php/picture.JPG

http://tdv.td.ohost.de/php/thumbnail.php

Wo ist mein Fehler?

MfG thecreep

  1. Moin!

    <?php

    //DAS NEUE BILD ERZEUGEN

    // Als 256-Farben-Vorlage

    $image= imagecreate($WIDTH,$HEIGHT);
    ?>

      
    
    > Wo ist mein Fehler?  
      
    Du willst Truecolor? Dann nimm Truecolor! :)  
      
     - Sven Rautenberg
    
    1. Du willst Truecolor? Dann nimm Truecolor! :)

      Jo - weil...

      Note: There is a problem due to palette image limitations (255+1 colors). Resampling or filtering an image commonly needs more colors than 255, a kind of approximation is used to calculate the new resampled pixel and its color. With a palette image we try to allocate a new color, if that failed, we choose the closest (in theory) computed color. This is not always the closest visual color. That may produce a weird result, like blank (or visually blank) images. To skip this problem, please use a truecolor image as a destination image, such as one created by imagecreatetruecolor().