From 446461ce562f982ee3a768036083091b9b2e30e6 Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Sun, 1 Jul 2012 23:42:25 -0400 Subject: it finally works --- fly-tools/derive-background/pixel.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/fly-tools/derive-background/pixel.c b/fly-tools/derive-background/pixel.c index 34d6596..605cfea 100644 --- a/fly-tools/derive-background/pixel.c +++ b/fly-tools/derive-background/pixel.c @@ -24,17 +24,15 @@ int main(int argc, char **argv ) { MagickWand *magick_wand; MagickWand *first_wand; + PixelIterator* iterator; + PixelWand **pixels; double green, red, blue; - int i,j, k; - int x,y; - + int i,j, k, x, y; int image = 0; - int height = 0; - int width = 0; + unsigned long height, width; int nImages = 0; - unsigned long number_wands; char filename[256]; char rgb[128]; @@ -53,7 +51,7 @@ int main(int argc, char **argv ) { first_wand = DestroyMagickWand(first_wand); - printf("height: %d width:%d \n", height, width); + printf("height: %ld width:%ld \n", height, width); // count how many images there are in the input file @@ -73,7 +71,7 @@ int main(int argc, char **argv ) { for(i = 0; i < nImages; i++) { array[i] = calloc(height, sizeof(array[0][0])); - for(j = 0; j < height; j++) + for(j = 0; j < (long) height; j++) { array[i][j] = calloc(width, sizeof(array[0][0][0])); for(k = 0; k < width; k++) @@ -95,16 +93,16 @@ int main(int argc, char **argv ) { magick_wand = NewMagickWand(); MagickReadImage(magick_wand, filename); - PixelIterator* iterator = NewPixelIterator(magick_wand); + iterator = NewPixelIterator(magick_wand); - PixelWand **pixels = PixelGetNextIteratorRow(iterator,&number_wands); printf("Image number:%d Filename: %s \n", image, filename); - for (i=0; pixels != (PixelWand **) NULL; i++) { - for (j=0; j