Jump to content

Get properties of a pcx file


BrknPhoenix

Recommended Posts

[!--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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.