Jump to content

Archived

This topic is now archived and is closed to further replies.

BrknPhoenix

Get properties of a pcx file

Recommended Posts

I need to get the properties of a PCX file, such as color depth, but php doesn't seem to have a lot of support for pcx files. Is there a way to do it?

Share this post


Link to post
Share on other sites
[!--quoteo(post=365505:date=Apr 17 2006, 12:41 PM:name=BrknPhoenix)--][div class=\'quotetop\']QUOTE(BrknPhoenix @ Apr 17 2006, 12:41 PM) [snapback]365505[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I need to get the properties of a PCX file, such as color depth, but php doesn't seem to have a lot of support for pcx files. Is there a way to do it?
[/quote]

if all you're after is the info of the file, then fopen/fread functions can be used to construct something to read the header of a PCX file. a quick google search for 'pcx file format' gave me this:
[a href=\"http://courses.ece.uiuc.edu/ece390/books/labmanual/graphics-pcx.html\" target=\"_blank\"]http://courses.ece.uiuc.edu/ece390/books/l...aphics-pcx.html[/a] which although has nothing to do with PHP, it'll show you what each bit of info you retrieve with 'fread' means. taking a guess from that link, , it looks like the colordepth is 3 bytes in. so:

[code]
$file = f open($filename, 'r');

f seek($file, 3);

$depth = f read($file, 1);

f close($file);

echo 'depth is '.$depth;
[/code]
[b]note:[/b] i've added a space in the fopen/fseek/fread/fclose functions in my example as it wasn't letting me post my reply. obviously just remove these first.

if that works, it'd be easy enough to get the other info from the file you need.
cheers
Mark

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.