1. First, you do not create images at any particular number of dots per inch, Dpi is a measure of the output (printer) or display (screen) resolution, on which an image is viewed.

    If you create an image 500x500 and then view it on a 1280x1024 15" screen, then the image will be 5 3/16 inches per side which equates to 96dpi.

    However, if you display that same image on a smartphone with a 800x480 4.3 inch screen, then (assuming that the browser doesn't do any scaling) the image will be 2.1 inches per side; which translates to 237 dpi.

    Same image, different dpi depending upon what it is displayed or printed on.

    In order to view a 500x500 image at 300 dpi, it would have to be displayed or printed on a device capable of 300 pixels per inch -- eg. a printer -- and would show up as 1.67 inches per side.

  2. Second, GD is just as capable of creating high quality images as any other drawing package -- but you do have to use it properly.

    The first problem appears to be that you are creating 8-bit color images instead of 24-bit color images. That's your fault not the modules.

    If you do my $gd = GD::Image->new( 500, 500 ); then you'll get a palettised 8-bit color image.

    If you do my $gd = GD::Image->new( 500, 500, 1 ); then you'll get a 24-bit (true)color image.

    You'll probably need to make some other changes to your current code to achieve best results, but as you haven't posted it, we can't advise you further.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?


In reply to Re: How to create images with 300dpi? by BrowserUk
in thread How to create images with 300dpi? by aky

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.