SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: GD2 rendering

  1. #1
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    GD2 rendering

    Hi,

    I have a quick question. I am using GD2 to create thumbnails. The script is outputting gifs from jpg and gif images. The problem I am encountering is quality of outputted images.

    My question is if the output of gd2 is dependent on the script being used or on the settings of GD2.

    If the former, can you recommend a fast script with high quality rendering.

    Thanks,

    DH

  2. #2
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, but this is not the right forum.

  3. #3
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    luke maybe you can guide me to the right forum as I haven't been able to receive a single reply anywhere else.

    DH

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The script is outputting gifs from jpg and gif images.
    The problem may be that the quality of the JPEGs are too low? But is GD actually upto producing quality images during the conversion I'm pondering. Maybe prior to generating the GIF image, you could remodel the JPEG at maximum quality.

    But this thread I think belongs in the normal PHP forum as Luke has pointed out

  5. #5
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, I don't mind if the thread is moved.

    I actually tested with very good quality jpeg and compared the result with another site. The quality is a lot lower. Could you give me some advice on how to remodel JPEGs?

    Alternatively do you know of a class script to do this?

    DH

    PS: do you think ImageMagick is a better alternative?
    Last edited by dhtmlhelp; May 8, 2005 at 15:53.

  6. #6
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I wanted to clarify one point which maybe made someone feel this was a simple issue.

    Every image uploaded is being converted to 4 fixed sizes: 30*30, 100*100, 180*180, and 360*360. Only the larger side is reduced, and any missing pixels are filled with white pixels by merging the uploaded image with 4 white images of the sizes specified above. Any image smaller than 360 is still rendered in an acceptable manner by the class.

    I presume quality is lost when merging uploaded images with the white canvases.

    That is esentially why I am encountering problems as simply resizing images without adding any white space works just fine.

    DH

  7. #7
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How are you doing this. Use imagecopyresampled and not imagecopyresized. This is a common mistake.

    Another thing, how are resizing. Are you resizing all of the canvases by loading the master image and resizing down from that. That's what i do. Don't resize to 360x360 from the master, and then resize down to 180x180 from the 360x360 etc etc, as the small image will probably not be very good quality, especially if you are reloading the canvas from the JPEG produced.

    Failing that, maybe you have an issue a dodgy version of libJPEG being compiled with GD if you are using an external version of GD.

  8. #8
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Miijay,

    yes using original image every time, but I was using imagecopyresized. Will test this, I have the latest lib.

    Any suggestions on how to speed up GD2?

    DH

    PS: tested and works really well. Only problem I am left with is speed. As far as I know GD2 is slower than alternatives like imagemagick, but it is embedded in php.

    Anyone knows of ways to speed it up?
    Last edited by dhtmlhelp; May 9, 2005 at 04:08.

  9. #9
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know any real ways to speed it up. I often use it to resize & merge images like you, along for serveside CSS typography rendering. This can put a lot of stress on the server. The way I get round this is simply to "cache" as much as I can once the image is rendered. Obviously, this is very project specific, and the usefulness is again dependant on what you project is trying to achieve


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •