aboutsummaryrefslogtreecommitdiff
path: root/fly-tools
diff options
context:
space:
mode:
authormutantturkey <mutantturke@gmail.com>2012-06-29 17:48:01 -0400
committermutantturkey <mutantturke@gmail.com>2012-06-29 17:48:01 -0400
commitcbc77697dbbd7bf645566c5f962323cc1354c136 (patch)
tree1514a147b1daaef631f83542502f6bf4481cb478 /fly-tools
parent689768d33aae8c98d10106a499fb6a899cca1355 (diff)
it's alive
Diffstat (limited to 'fly-tools')
-rw-r--r--fly-tools/derive-background/pixel.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/fly-tools/derive-background/pixel.c b/fly-tools/derive-background/pixel.c
index 39c3f49..34d6596 100644
--- a/fly-tools/derive-background/pixel.c
+++ b/fly-tools/derive-background/pixel.c
@@ -42,23 +42,6 @@ int main(int argc, char **argv ) {
uint8_t ****array;
- // initialize the storage array.
- array = calloc(nImages, sizeof(array[0]));
- for(i = 0; i < nImages; i++)
- {
- array[i] = calloc(height, sizeof(array[0][0]));
- for(j = 0; j < height; j++)
- {
- array[i][j] = calloc(width, sizeof(array[0][0][0]));
- for(k = 0; k < width; k++)
- {
- array[i][j][k] = calloc(3, sizeof(array[0][0][0][0]));
- }
- }
- }
-
- MagickWandGenesis();
-
// open the first image and get the height and width
first_wand = NewMagickWand();
if(MagickReadImage(first_wand, argv[2]) == MagickFalse) {
@@ -85,6 +68,22 @@ int main(int argc, char **argv ) {
printf("number of imagges: %d \n", nImages);
+ // initialize the storage array.
+ array = calloc(nImages, sizeof(array[0]));
+ for(i = 0; i < nImages; i++)
+ {
+ array[i] = calloc(height, sizeof(array[0][0]));
+ for(j = 0; j < height; j++)
+ {
+ array[i][j] = calloc(width, sizeof(array[0][0][0]));
+ for(k = 0; k < width; k++)
+ {
+ array[i][j][k] = calloc(3, sizeof(array[0][0][0][0]));
+ }
+ }
+ }
+
+ MagickWandGenesis();
// store each pixel in the storage array. array[nImage][height][width][ { R, G, B} ]
FILE *input_file = fopen ( argv[1], "r" );
@@ -166,7 +165,7 @@ int main(int argc, char **argv ) {
PixelSetColor(p_wand,"white");
m_wand = NewMagickWand();
- MagickNewImage(m_wand,height,width,p_wand);
+ MagickNewImage(m_wand,width,height,p_wand);
iterator=NewPixelIterator(m_wand);