GD default DPI

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

    GD default DPI

    Hi,

    I'm currently making a website that needs to edit images with adding text,
    the problem is, the picture starts at 300 DPI (pixels/inch), but after GD
    edits the image, it's set to 72 which i read to be the default value GD
    always uses. is there a way to edit that default to a higher number, if not
    are there other ways to edit images through php and still keeping the
    original DPI.


  • denisb

    #2
    Re: GD default DPI

    "MC" <madcow@false > wrote:[color=blue]
    > I'm currently making a website that needs to edit images with adding text,
    > the problem is, the picture starts at 300 DPI (pixels/inch), but after GD
    > edits the image, it's set to 72 which i read to be the default value GD
    > always uses. is there a way to edit that default to a higher number, if not
    > are there other ways to edit images through php and still keeping the
    > original DPI.[/color]

    hi mc* !

    here is an answer which I made here in May 2004

    <cite>
    first : sorry for my (very) bad english, but I'm french (and nobody's
    perfect...)**

    about picture :
    picture is defined by X pixels x Y pixels (ie : 1200px x 856px).
    on web (screen) this picture will fill a surface of 1200 pixels by 856
    pixels.
    but for printing it (on paper) you must calculate :
    if you print at 300dpi (good offset), dimensions of your picture on
    paper will be 1200/300 by 856/300 thus 4 inches by 2.8 inches ;
    if you print at 135dpi (offset), dimensions of your picture on paper
    will be 1200/3135 by 856/135 thus 8.9 inches by 6.3 inches.

    and if you want a 12 inches by 8.6 inches picture on paper its
    resolution will be 100dpi.

    thus, you can know the quality of your final print just by knowing the
    dimensions (in pixels) of your picture.

    about gd :
    when I create a jpeg image with gd, I always have a 72dpi image.
    I use the php getimagesize function and I calculate :
    round((getimage size($my_pictur e)[0] * 0.85) / 100)
    for width (cm) at 300dpi ;
    round((getimage size($my_pictur e)[1] * 0.85) / 100)
    for height (cm) at 300dpi.

    'et voila !'
    </cite>


    * here, in france, we have just had the first 'mad **goat**' !
    what is a little worrying...
    ** this did not change !

    --
    @@@@@
    E -00 yes ! france... near japan !
    ' `) /
    |\_ =="

    Comment

    • MC

      #3
      Re: GD default DPI

      Well, so u're saying i need to enlarge the image to later on resample it to
      a smaller size so the DPI value is higher?
      But i start with "uploaded" images, so if if i enlarge that image to later
      resample won't the DPI value be lower again and/or won't the image have less
      good pixelations?
      "denisb" <newdb@no-log.org> schreef in bericht
      news:1grasr8.1b pesjdfkvo00N%ne wdb@no-log.org...[color=blue]
      > "MC" <madcow@false > wrote:[color=green]
      >> I'm currently making a website that needs to edit images with adding
      >> text,
      >> the problem is, the picture starts at 300 DPI (pixels/inch), but after GD
      >> edits the image, it's set to 72 which i read to be the default value GD
      >> always uses. is there a way to edit that default to a higher number, if
      >> not
      >> are there other ways to edit images through php and still keeping the
      >> original DPI.[/color]
      >
      > hi mc* !
      >
      > here is an answer which I made here in May 2004
      >
      > <cite>
      > first : sorry for my (very) bad english, but I'm french (and nobody's
      > perfect...)**
      >
      > about picture :
      > picture is defined by X pixels x Y pixels (ie : 1200px x 856px).
      > on web (screen) this picture will fill a surface of 1200 pixels by 856
      > pixels.
      > but for printing it (on paper) you must calculate :
      > if you print at 300dpi (good offset), dimensions of your picture on
      > paper will be 1200/300 by 856/300 thus 4 inches by 2.8 inches ;
      > if you print at 135dpi (offset), dimensions of your picture on paper
      > will be 1200/3135 by 856/135 thus 8.9 inches by 6.3 inches.
      >
      > and if you want a 12 inches by 8.6 inches picture on paper its
      > resolution will be 100dpi.
      >
      > thus, you can know the quality of your final print just by knowing the
      > dimensions (in pixels) of your picture.
      >
      > about gd :
      > when I create a jpeg image with gd, I always have a 72dpi image.
      > I use the php getimagesize function and I calculate :
      > round((getimage size($my_pictur e)[0] * 0.85) / 100)
      > for width (cm) at 300dpi ;
      > round((getimage size($my_pictur e)[1] * 0.85) / 100)
      > for height (cm) at 300dpi.
      >
      > 'et voila !'
      > </cite>
      >
      >
      > * here, in france, we have just had the first 'mad **goat**' !
      > what is a little worrying...
      > ** this did not change !
      >
      > --
      > @@@@@
      > E -00 yes ! france... near japan !
      > ' `) /
      > |\_ =="[/color]


      Comment

      • denisb

        #4
        Re: GD default DPI

        "MC" <madcow@false > wrote:[color=blue]
        > Well, so u're saying i need to enlarge the image to later on resample it to
        > a smaller size so the DPI value is higher?
        > But i start with "uploaded" images, so if if i enlarge that image to later
        > resample won't the DPI value be lower again and/or won't the image have less
        > good pixelations?[/color]

        no no no.

        the image uploaded has its own dimensions : xxx pixels by xxx pixels.
        that's all.

        I understand that you use gd to add text to this image.

        if the image is large enough to be printed correctly, just add your text
        on it (do it by envisaging for the text an adapted size) then
        dimensions of the new image, created by gd, will not have changed.

        but, the best you can do is to test yourself :

        upload an image 250 px by 400 px (300dpi or 72dpi, we don't care) ;
        do your job ;
        download the new image ;
        see what happens

        --
        @@@@@
        E -00 comme on est very beaux dis !
        ' `) /
        |\_ =="

        Comment

        • Dani CS

          #5
          Re: GD default DPI

          MC wrote:[color=blue]
          > Hi,
          >
          > I'm currently making a website that needs to edit images with adding text,
          > the problem is, the picture starts at 300 DPI (pixels/inch), but after GD
          > edits the image, it's set to 72 which i read to be the default value GD
          > always uses. is there a way to edit that default to a higher number, if not
          > are there other ways to edit images through php and still keeping the
          > original DPI.
          >
          >[/color]

          What about ImageMagick? There's a PHP module for it, called 'php_magick'.

          Comment

          Working...