Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Loop through pixels with libpng

Name: Anonymous 2011-09-10 14:02

Hi /prog/,

I need to write a little tool that gives a list (x,y) of pixels in a png file that are not white. I did this in java, but because of the high footprint, I'd like to redo it in C/C++. I have a little experience with this languages, but none with libpng (I assumed this was the way to go).

So what I basically want to do is loop through each pixel in a PNG file and check the color. What would be the best way to do that with libpng?

Thanks in advance

Name: Cudder !MhMRSATORI!FBeUS42x4uM+kgp 2011-09-11 4:21

>>5
for (i = 0; i < num_px; i++)
 if(buffer[i]!=16777215)
  printf("%d,%d\n",i%width,i/height);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List