resized images give crappy quality - why?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dag Eilertsen

    resized images give crappy quality - why?

    The script below resizes images into two different sizes. My problem is that
    the quality of the resized images is poor. Any idea how to improve my
    script? The users are only uploading jpg's.

    Thanks!
    Dag Eilertsen
    _______________ _______________ _______________ _______________ _______________ _
    _

    $bilde = "./" .$lagringssti .$filnavn1;
    $pic = @imagecreatefro mjpeg($bilde) or die("Sorry!");
    if ($pic)
    {
    // Make thumb
    $width = imagesx($pic);
    $height = imagesy($pic);
    $twidth = 100;
    $theight = $twidth * $height / $width; // Regner ut høyden

    $thumb = @imagecreatetru ecolor ($twidth, $theight) or die ("Can't
    resize!");
    imagecopyresize d($thumb, $pic, 0, 0, 0, 0, $twidth, $theight, $width,
    $height); // Resize to thumb
    imagegammacorre ct($thumb, 1.0, 1.5);

    ImageJPEG($thum b,$lagringssti .basename($filn avn1,'.jpg')
    .."_thmb.jpg",1 00); // JPEG of thumb

    // Make small image
    $twidth = 230; // Vidde satt til 230 pixler
    $theight = $twidth * $height / $width; // Regner ut høyden
    $mediumPic = @imagecreatetru ecolor ($twidth, $theight) or die ("Can't
    change size");
    imagecopyresize d($mediumPic, $pic, 0, 0, 0, 0, $twidth, $theight, $width,
    $height);

    imageJPEG($medi umPic,$lagrings sti .basename($filn avn1,'.jpg')
    .."_small.jpg", 100);

    imagedestroy($t humb);
    imagedestroy($m ediumPic);

    // Delete the original file
    list($stamme, $extension) = split("\.", $filnavn1);

    unlink($lagring ssti .basename($filn avn1));

    } // End: if ($pic)


  • Geoff Berrow

    #2
    Re: resized images give crappy quality - why?

    I noticed that Message-ID: <40eb2a61@news. broadpark.no> from Dag
    Eilertsen contained the following:
    [color=blue]
    >The script below resizes images into two different sizes. My problem is that
    >the quality of the resized images is poor. Any idea how to improve my
    >script?[/color]

    Use imagecopyresamp led()
    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Alex

      #3
      Re: resized images give crappy quality - why?

      Use ImageMagick, not GD

      "Geoff Berrow" <blthecat@ckdog .co.uk> wrote in message
      news:0iame0teha 3ju9nio7gj8v6b9 uringtns5@4ax.c om...[color=blue]
      > I noticed that Message-ID: <40eb2a61@news. broadpark.no> from Dag
      > Eilertsen contained the following:
      >[color=green]
      > >The script below resizes images into two different sizes. My problem is[/color][/color]
      that[color=blue][color=green]
      > >the quality of the resized images is poor. Any idea how to improve my
      > >script?[/color]
      >
      > Use imagecopyresamp led()
      > --
      > Geoff Berrow (put thecat out to email)
      > It's only Usenet, no one dies.
      > My opinions, not the committee's, mine.
      > Simple RFDs http://www.ckdog.co.uk/rfdmaker/[/color]


      Comment

      • Geoff Berrow

        #4
        Re: resized images give crappy quality - why?

        I noticed that Message-ID:
        <2WFGc.21727$WM 5.962964@news20 .bellglobal.com > from Alex contained the
        following:
        [color=blue]
        >Use ImageMagick, not GD[/color]

        Users don't always have a choice.

        --
        Geoff Berrow (put thecat out to email)
        It's only Usenet, no one dies.
        My opinions, not the committee's, mine.
        Simple RFDs http://www.ckdog.co.uk/rfdmaker/

        Comment

        Working...