473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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
Jul 17 '05 #1
7 6556
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 documentation?

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

Regards,
Matthias
Jul 17 '05 #2
On Sat, 19 Jun 2004 07:13:48 GMT, "dan glenn" <da********@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 Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #3
"dan glenn" <da********@yahoo.com> wrote in message
news:MI*******************@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.
Jul 17 '05 #4

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:xc********************@comcast.com...
"dan glenn" <da********@yahoo.com> wrote in message
news:MI*******************@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
Jul 17 '05 #5
"dan glenn" <da********@yahoo.com> wrote in message
news:UF*******************@newssvr29.news.prodigy. com...

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:xc********************@comcast.com...
"dan glenn" <da********@yahoo.com> wrote in message
news:MI*******************@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.
Jul 17 '05 #6

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:ie********************@comcast.com...
"dan glenn" <da********@yahoo.com> wrote in message
news:UF*******************@newssvr29.news.prodigy. com...

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:xc********************@comcast.com...
"dan glenn" <da********@yahoo.com> wrote in message
news:MI*******************@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)
Jul 17 '05 #7
"dan glenn" <da********@yahoo.com> wrote in message news:<RF****************@newssvr25.news.prodigy.co m>...
<snip
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)


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
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kristofl | last post by:
Hi all, I store images in my DB as BLOB. When I want to place them in an html table, I want to determine the width of the image in order to asign the correct width to the column inside table....
6
by: Useko Netsumi | last post by:
Hi, I'm trying to experiment with the GD2 library(or GD for that matter) for win32 platform BUT could not find any that support it. Could you tell me where to find the binary of it? Thanks.
0
by: Klaus Boehmer | last post by:
Hello, I'm trying to install gd2 with gif-support as an extension with php4. I compiled the patched version of gd2 - fine. I compiled php4 with gd=shared - fine. I installed it and restarted...
4
by: Ruby Tuesday | last post by:
I have a section(185pixelsx 185pixels) in my web page to display an image that is stored in a directory. Using php, how do you resize so if: the image dimension is smaller(width and height is...
3
by: tjh | last post by:
hi - i'm a bit new to PHP - i've been messing around with the GD2 image functions and was wondering: i see a lot of information about converting a color image to grayscale but i can't figure...
1
by: Leif Wessman | last post by:
Hi, How can I/Is it possible to convert a jpg image to a favicon using php (including resizing it if needed)? Leif
5
by: Jim | last post by:
I've heard that resizing images through PHP (either GD2 or ImageMagick) is a processor intensive exercise. I'm setting up a site where users will be uploading up to 10 images along with the details...
2
by: Bob Bedford | last post by:
I've an image that is 300x225 pixels. I've to send this image to mobile phones using the mms. For this the best result is given using 120x160 pixels. So I may generate a 120 pixels large image,...
12
by: laredotornado | last post by:
Hi, I'm using PHP 5. I was wondering given an image, a.jpg, how can I make an image that would look like you slid a white index card (which I have a file, white.jpg with the same dimensions as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.