我尝试使用如下所示的CGImageSourceCreateWithURL
方法,但似乎高度和宽度都等于0
。还有其他方法可以从URL获取webp图像吗?
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)imageUrl, NULL);
NSDictionary* imageHeader = (__bridge NSDictionary*) CGImageSourceCopyPropertiesAtIndex(source, 0, NULL);
NSLog(@"Image header %@",imageHeader);
NSLog(@"PixelHeight %@",[imageHeader objectForKey:@"PixelHeight"]);
NSNumber* height = [imageHeader objectForKey:@"PixelHeight"];
NSNumber* width = [imageHeader objectForKey:@"PixelWidth"];