is it possible to convert image types (GD2)

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

    is it possible to convert image types (GD2)

    (PHP4.3.4) Is it possible to change an image that's in one type (jpg, gif,
    png) into another type? Especially, I know I can read a gif with GD2, but I
    really need to be able to save it as a png. Is that possible?

    -dg


  • Matthias Esken

    #2
    Re: is it possible to convert image types (GD2)

    dan glenn schrieb:
    [color=blue]
    > (PHP4.3.4) Is it possible to change an image that's in one type (jpg, gif,
    > png) into another type? Especially, I know I can read a gif with GD2, but I
    > really need to be able to save it as a png. Is that possible?[/color]

    Why don't you just have a look at the documentation?



    Regards,
    Matthias

    Comment

    • Andy Hassall

      #3
      Re: is it possible to convert image types (GD2)

      On Sat, 19 Jun 2004 07:13:48 GMT, "dan glenn" <dan_danboy@yah oo.com> wrote:
      [color=blue]
      >(PHP4.3.4) Is it possible to change an image that's in one type (jpg, gif,
      >png) into another type? Especially, I know I can read a gif with GD2, but I
      >really need to be able to save it as a png. Is that possible?[/color]

      Yes, it is.

      --
      Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
      http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

      Comment

      • Chung Leong

        #4
        Re: is it possible to convert image types (GD2)

        "dan glenn" <dan_danboy@yah oo.com> wrote in message
        news:MIRAc.7495 8$Im3.18399@new ssvr29.news.pro digy.com...[color=blue]
        > (PHP4.3.4) Is it possible to change an image that's in one type (jpg, gif,
        > png) into another type? Especially, I know I can read a gif with GD2, but[/color]
        I[color=blue]
        > really need to be able to save it as a png. Is that possible?
        >[/color]

        You can convert gif into png or jpeg but no vice-versa. The imagepng() and
        impagejpeg() will save the image into the respected format.


        Comment

        • dan glenn

          #5
          Re: is it possible to convert image types (GD2)


          "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
          news:xc2dnb2jIt uK00ndRVn-vg@comcast.com. ..[color=blue]
          > "dan glenn" <dan_danboy@yah oo.com> wrote in message
          > news:MIRAc.7495 8$Im3.18399@new ssvr29.news.pro digy.com...[color=green]
          > > (PHP4.3.4) Is it possible to change an image that's in one type (jpg,[/color][/color]
          gif,[color=blue][color=green]
          > > png) into another type? Especially, I know I can read a gif with GD2,[/color][/color]
          but[color=blue]
          > I[color=green]
          > > really need to be able to save it as a png. Is that possible?
          > >[/color]
          >
          > You can convert gif into png or jpeg but no vice-versa. The imagepng() and
          > impagejpeg() will save the image into the respected format.[/color]

          OK - I'm now saving .gif's to .png's, but I note that I lose the
          transparancy (if there is one) in doing so. How can I maintain the
          transparancy in the PNG???

          -dg


          Comment

          • Chung Leong

            #6
            Re: is it possible to convert image types (GD2)

            "dan glenn" <dan_danboy@yah oo.com> wrote in message
            news:UF2Bc.7556 9$1R7.72583@new ssvr29.news.pro digy.com...[color=blue]
            >
            > "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
            > news:xc2dnb2jIt uK00ndRVn-vg@comcast.com. ..[color=green]
            > > "dan glenn" <dan_danboy@yah oo.com> wrote in message
            > > news:MIRAc.7495 8$Im3.18399@new ssvr29.news.pro digy.com...[color=darkred]
            > > > (PHP4.3.4) Is it possible to change an image that's in one type (jpg,[/color][/color]
            > gif,[color=green][color=darkred]
            > > > png) into another type? Especially, I know I can read a gif with GD2,[/color][/color]
            > but[color=green]
            > > I[color=darkred]
            > > > really need to be able to save it as a png. Is that possible?
            > > >[/color]
            > >
            > > You can convert gif into png or jpeg but no vice-versa. The imagepng()[/color][/color]
            and[color=blue][color=green]
            > > impagejpeg() will save the image into the respected format.[/color]
            >
            > OK - I'm now saving .gif's to .png's, but I note that I lose the
            > transparancy (if there is one) in doing so. How can I maintain the
            > transparancy in the PNG???
            >[/color]

            Hmmm, I just tried it and it works correctly. I'm using 4.3.6. Maybe GD is
            saving the PNG with alpha-channel info (which IE doesn't support) instead of
            single color transparency. View the image in Netscape or open it with
            Photoshop and see if transparency is there.


            Comment

            • dan glenn

              #7
              Re: is it possible to convert image types (GD2)


              "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
              news:ie2dnQO1r4 AZRkndRVn-gg@comcast.com. ..[color=blue]
              > "dan glenn" <dan_danboy@yah oo.com> wrote in message
              > news:UF2Bc.7556 9$1R7.72583@new ssvr29.news.pro digy.com...[color=green]
              > >
              > > "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
              > > news:xc2dnb2jIt uK00ndRVn-vg@comcast.com. ..[color=darkred]
              > > > "dan glenn" <dan_danboy@yah oo.com> wrote in message
              > > > news:MIRAc.7495 8$Im3.18399@new ssvr29.news.pro digy.com...
              > > > > (PHP4.3.4) Is it possible to change an image that's in one type[/color][/color][/color]
              (jpg,[color=blue][color=green]
              > > gif,[color=darkred]
              > > > > png) into another type? Especially, I know I can read a gif with[/color][/color][/color]
              GD2,[color=blue][color=green]
              > > but[color=darkred]
              > > > I
              > > > > really need to be able to save it as a png. Is that possible?
              > > > >
              > > >
              > > > You can convert gif into png or jpeg but no vice-versa. The imagepng()[/color][/color]
              > and[color=green][color=darkred]
              > > > impagejpeg() will save the image into the respected format.[/color]
              > >
              > > OK - I'm now saving .gif's to .png's, but I note that I lose the
              > > transparancy (if there is one) in doing so. How can I maintain the
              > > transparancy in the PNG???
              > >[/color]
              >
              > Hmmm, I just tried it and it works correctly. I'm using 4.3.6. Maybe GD is
              > saving the PNG with alpha-channel info (which IE doesn't support) instead[/color]
              of[color=blue]
              > single color transparency. View the image in Netscape or open it with
              > Photoshop and see if transparency is there.[/color]

              Yes, you're right - the transparency is there. It was just IE. Gad. OK - is
              there a way I can make imagepng() save the PNG as a palette-based (8-bit,
              256-color) single-color transparancy? (These will work in IE, as they don't
              use the alpha channel)


              Comment

              • R. Rajesh Jeba Anbiah

                #8
                Re: is it possible to convert image types (GD2)

                "dan glenn" <dan_danboy@yah oo.com> wrote in message news:<RF7Bc.216 9$Re2.266@newss vr25.news.prodi gy.com>...
                <snip[color=blue][color=green]
                > > Hmmm, I just tried it and it works correctly. I'm using 4.3.6. Maybe GD is
                > > saving the PNG with alpha-channel info (which IE doesn't support) instead[/color]
                > of[color=green]
                > > single color transparency. View the image in Netscape or open it with
                > > Photoshop and see if transparency is there.[/color]
                >
                > Yes, you're right - the transparency is there. It was just IE. Gad. OK - is
                > there a way I can make imagepng() save the PNG as a palette-based (8-bit,
                > 256-color) single-color transparancy? (These will work in IE, as they don't
                > use the alpha channel)[/color]

                You may be interested in phpSt.Justin's wonderful article on the
                subject <http://www.koivi.com/ie-png-transparency/>

                --
                | Just another PHP saint |
                Email: rrjanbiah-at-Y!com

                Comment

                Working...