Spritesheet loses transparent background
Posted: 2016-05-27T08:24:23-07:00
Hello guys i'm new with MagickWand and i was trying to make a spritesheet using the command MagickMontageImage in C. I have 5 sprites in format .PNG that already has transparent background, but after the montage i obtain a spritesheet with a white background. Using bash i dont have this problem, but i want the same result coding in C. I tried set image background, and replace the white color with transparent but i dont obtain the same result as the bash way that is more popular. Here's the code, the sprites and the spritesheet give as result with the wrong background. I hope you can help me cause this is blowing my mind. Thank you!
Code:
Input sprites:





Output spritesheet:

Code:
Code: Select all
MagickWand *wand = NULL;
MagickWandGenesis();
wand = NewMagickWand();
DrawingWand *d_wand = NewDrawingWand();
MagickSetLastIterator(wand);
MagickReadImage(wand, "/test/0.png");
MagickSetLastIterator(wand);
MagickReadImage(wand, "/test/1.png");
MagickSetLastIterator(wand);
MagickReadImage(wand, "/test/2.png");
MagickSetLastIterator(wand);
MagickReadImage(wand, "/test/3.png");
MagickSetLastIterator(wand);
MagickReadImage(wand, "/test/4.png");
wand = MagickMontageImage(wand, d_wand, "5x1+0+0", "64x64+0+0", ConcatenateMode, "0x0+0+0");
MagickWriteImage(wand, "/test/spritesheet.png");
wand = DestroyMagickWand(wand);
d_wand = DestroyDrawingWand(d_wand);
MagickWandTerminus();
return 0;





Output spritesheet:
