6
我正在使用ImageMagick的iPhone端口。我試圖循環遍歷動畫gif的幀,並將每個幀轉換爲UIImage。我知道我可以用NSData初始化一個UIImage,我可以用一個const void *來初始化它。那麼如何獲得圖像的緩衝區和長度?如何從ImageMagick獲取c緩衝區圖像
下面的代碼:
MagickReadImage(wand, filename);
while(MagickHasNextImage(wand)) {
Image *myImage = GetImageFromMagickWand(wand);
//HELP ME PLEASE
const void *myBuff =myImage->blob; //guessing this is the right way to get the buffer?
int myLength = ????? //no idea how to get the length
NSData *myData = [[NSData alloc] initWithBytes:myBuff length:myLength];
UIImage myImage = [[UIImage alloc] initWithData:myData]];
MagickNextImage(wand);
}