Bytes to bits in for graphics processing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Bytes to bits in for graphics processing

Post by superdezign »

In order to process an *.ico image into a different format, I ifrst have to be able to get each bit. I have access to each byte, as file_get_contents() gives me a byte by byte binary string (which I think is cool), but I'm having difficulty breaking it into bits for 1-bit, 4-bit, and 8-bit graphics. Any suggestions/resources?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I'd suggest using ImageMagick.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

It looks like a powerful library, but just like GD, it doesn't support the *.ico format. So, I still have the same dilemma.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

It has read support for .ico files.
see http://www.imagemagick.org/script/formats.php
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Ahhh. I only checked my PHP Manual files. Thanks for that. ^_^
It was cool being able to read the entire file byte by byte though. Oh well.

Edit: Oh, I didn't know it wasn't an included library. :?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Does PHP have a function for retrieving ASCII values? Typecasting to int doesn't do it.

Edit: Nevermind. I did some more searching, and I think ord() is what I'm after.
Post Reply