Jump to content


Photo

Get properties of a pcx file


  • Please log in to reply
1 reply to this topic

#1 BrknPhoenix

BrknPhoenix
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 17 April 2006 - 11:41 AM

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?

#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 17 April 2006 - 01:55 PM

[!--quoteo(post=365505:date=Apr 17 2006, 12:41 PM:name=BrknPhoenix)--][div class=\'quotetop\']QUOTE(BrknPhoenix @ Apr 17 2006, 12:41 PM) View Post[/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:

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

f seek($file, 3);

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

f close($file);

echo 'depth is '.$depth;
note: 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
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users