/
Image Dimension
Image Dimension
NSURL *imageFileURL = [NSURL fileURLWithPath:...]; // Put your image in a URL CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)imageFileURL, NULL); if (imageSource == NULL) { // Error loading image ... return; } CGFloat width = 0.0f, height = 0.0f; CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL); if (imageProperties != NULL) { CFNumberRef widthNum = CFDictionaryGetValue(imageProperties, kCGImagePropertyPixelWidth); if (widthNum != NULL) { CFNumberGetValue(widthNum, kCFNumberCGFloatType, &width); } CFNumberRef heightNum = CFDictionaryGetValue(imageProperties, kCGImagePropertyPixelHeight); if (heightNum != NULL) { CFNumberGetValue(heightNum, kCFNumberCGFloatType, &height); } CFRelease(imageProperties); } NSLog(@"Image dimensions: %.0f x %.0f px", width, height);
, multiple selections available,
Related content
LaunchImage
LaunchImage
More like this
iOS AutoLayout - get frame size width
iOS AutoLayout - get frame size width
More like this
UIGetScreenImage
UIGetScreenImage
More like this
NSLayoutConstraint-代码实现自动布局的函数用法说明
NSLayoutConstraint-代码实现自动布局的函数用法说明
More like this
UIColor to UIImage
UIColor to UIImage
More like this