in reply to Re: How to improve image resolution
in thread How to improve image resolution...Continued

Thanks for the posting. Sorry for not including these details before. I am basically creating an image using the image() and printing it in gif format. The images does nothave smooth margins and also the colors donot appear as true color. I am not aware of any compression. Thanks
$im = new GD::Image(1000,100); blah...blah print $im->gif;

Replies are listed 'Best First'.
Re^3: How to improve image resolution
by BrowserUk (Patriarch) on Aug 06, 2005 at 05:59 UTC

    Try adding the truecolor parameter when you create your images:

    $im = new GD::Image(1000,100, 1); ## Note the extra parameter!

    From the GD docs:

    The optional third argument, $truecolor, tells new() to create a truecolor GD::Image object. Truecolor images have 24 bits of color data (eight bits each in the red, green and blue channels respectively), allowing for precise photograph-quality color usage. If not specified, the image will use an 8-bit palette for compatibility with older versions of libgd.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
      Hi BrowserUk,

      Thanks for the posting. I tired this earlier but was puzzled to see the white background converting to black. Thought I was commiting some blunder. Apart from this I dint see any change in the resolution or the color (annoyingly, red appears as orange, pink as violet etc)

        It sounds like you are (still) using palettized colours in conjunction with your (now) truecolor image?

        Rather than continue this guessing game, is it possible for you to post an example of the code that is producing unsatisfactory images? It would save much time.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.