Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with GD Library

Status
Not open for further replies.

DJMittens

Programmer
Dec 20, 2004
10
0
0
CA
Hello all,

I have a 2-dimensional boolean array created, and I want to export it to a jpeg such that if a point is true, it sets the associated pixel as black, and if it's false, it leaves it white.

All I need is the script to draw pixels to the image map. Thanks for your help in advance.
 
jpgs use a compression algorithm of some sort so you can't just create it on the fly. Why not try creating a bmp first. OK it is big but if you keep to 2 colours it will reduce the size. Then you can use something like the imagemagick library to convert it from bmp to jpg.

Note that jpgs do not decompress to the same thing that they started with and the image degrades very quickly if you keep modifying it.
 
Well, I found the script I needed to write individual pixels. I'm not manipulating the image, I'm just writing to it on the fly with default compression (which has worked fine in the past).
 
Could it be something silly like not opening the file for binary write? That is the mistake I always make.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top