> Programming Languages > PHP
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on PHP



PHP - "is it possible to convert image types (GD2)" in Programming Languages


Old 06-19-2004   #1
..n ..e..
 
Default 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


 
Old 06-19-2004   #2
..tthi.. ..k..
 
Default Re: is it possible to convert image types (GD2)

dan glenn schrieb:

> (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?


Why don't you just have a look at the do***entation?

http://www.php.net/manual/en/function.imagepng.php

Regards,
Matthias
 
Old 06-19-2004   #3
.... ..ssa..
 
Default Re: is it possible to convert image types (GD2)

On Sat, 19 Jun 2004 07:13:48 GMT, "dan glenn" <dan_danboy@yahoo.com> wrote:

>(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?


Yes, it is.

--
Andy H***all <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
 
Old 06-19-2004   #4
..u.. ..o..
 
Default Re: is it possible to convert image types (GD2)

"dan glenn" <dan_danboy@yahoo.com> wrote in message
news:MIRAc.74958$Im3.18399@newssvr29.news.prodigy. com...
> (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?
>


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


 
Old 06-19-2004   #5
..n ..e..
 
Default Re: is it possible to convert image types (GD2)


"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:xc2dnb2jItuK00ndRVn-vg@comcast.com...
> "dan glenn" <dan_danboy@yahoo.com> wrote in message
> news:MIRAc.74958$Im3.18399@newssvr29.news.prodigy. com...
> > (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?
> >

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


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


 
Old 06-20-2004   #6
..u.. ..o..
 
Default Re: is it possible to convert image types (GD2)

"dan glenn" <dan_danboy@yahoo.com> wrote in message
news:UF2Bc.75569$1R7.72583@newssvr29.news.prodigy. com...
>
> "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
> news:xc2dnb2jItuK00ndRVn-vg@comcast.com...
> > "dan glenn" <dan_danboy@yahoo.com> wrote in message
> > news:MIRAc.74958$Im3.18399@newssvr29.news.prodigy. com...
> > > (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?
> > >

> >
> > You can convert gif into png or jpeg but no vice-versa. The imagepng()

and
> > impagejpeg() will save the image into the respected format.

>
> 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???
>


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.


 
Old 06-20-2004   #7
..n ..e..
 
Default Re: is it possible to convert image types (GD2)


"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:ie2dnQO1r4AZRkndRVn-gg@comcast.com...
> "dan glenn" <dan_danboy@yahoo.com> wrote in message
> news:UF2Bc.75569$1R7.72583@newssvr29.news.prodigy. com...
> >
> > "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
> > news:xc2dnb2jItuK00ndRVn-vg@comcast.com...
> > > "dan glenn" <dan_danboy@yahoo.com> wrote in message
> > > news:MIRAc.74958$Im3.18399@newssvr29.news.prodigy. com...
> > > > (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?
> > > >
> > >
> > > You can convert gif into png or jpeg but no vice-versa. The imagepng()

> and
> > > impagejpeg() will save the image into the respected format.

> >
> > 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???
> >

>
> 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.


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)


 

Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0