kCGImagePropertyExifAuxDictionary对应的字典中可能包含的键定义如下:
//镜头信息
const CFStringRef kCGImagePropertyExifAuxLensInfo;
//镜头模式
const CFStringRef kCGImagePropertyExifAuxLensModel;
//序列号
const CFStringRef kCGImagePropertyExifAuxSerialNumber;
//镜头ID
const CFStringRef kCGImagePropertyExifAuxLensID;
//镜头序列号
const CFStringRef kCGImagePropertyExifAuxLensSerialNumber;
//图片编号
const CFStringRef kCGImagePropertyExifAuxImageNumber;
//闪光补偿
const CFStringRef kCGImagePropertyExifAuxFlashCompensation;
//所有者名称
const CFStringRef kCGImagePropertyExifAuxOwnerName;
//固件信息
const CFStringRef kCGImagePropertyExifAuxFirmware;
kCGImagePropertyGIFDictionary对应的字典中可能包含的键定义如下:
//动画循环次数
const CFStringRef kCGImagePropertyGIFLoopCount;
//两帧之间的延时
const CFStringRef kCGImagePropertyGIFDelayTime;
//颜色Map
const CFStringRef kCGImagePropertyGIFImageColorMap;
const CFStringRef kCGImagePropertyGIFHasGlobalColorMap;
//两帧之间的延时
const CFStringRef kCGImagePropertyGIFUnclampedDelayTime;
kCGImagePropertyPNGDictionary对应的字典中可能包含的键定义如下:
//PNG伽马值
const CFStringRef kCGImagePropertyPNGGamma;
//混合类型
const CFStringRef kCGImagePropertyPNGInterlaceType;
//X方向像素数
const CFStringRef kCGImagePropertyPNGXPixelsPerMeter;
//Y方向像素数
const CFStringRef kCGImagePropertyPNGYPixelsPerMeter;
//RGB意图
const CFStringRef kCGImagePropertyPNGsRGBIntent;
//色度
const CFStringRef kCGImagePropertyPNGChromaticities;
//作者
const CFStringRef kCGImagePropertyPNGAuthor;
//公司
const CFStringRef kCGImagePropertyPNGCopyright;
//创建时间
const CFStringRef kCGImagePropertyPNGCreationTime;
//描述
const CFStringRef kCGImagePropertyPNGDescription;
//最后修改日期时间
const CFStringRef kCGImagePropertyPNGModificationTime;
//软件
const CFStringRef kCGImagePropertyPNGSoftware;
//标题
const CFStringRef kCGImagePropertyPNGTitle;
//动画循环次数
const CFStringRef kCGImagePropertyAPNGLoopCount;
//两帧之间的延时
const CFStringRef kCGImagePropertyAPNGDelayTime;
const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime;
kCGImagePropertyGPSDictionary对应的字典中可能包含的键定义如下:
//GPS版本
const CFStringRef kCGImagePropertyGPSVersion;
//纬度是南纬或北纬
const CFStringRef kCGImagePropertyGPSLatitudeRef;
//纬度
const CFStringRef kCGImagePropertyGPSLatitude;
//经度是东经或西经
const CFStringRef kCGImagePropertyGPSLongitudeRef;
//经度
const CFStringRef kCGImagePropertyGPSLongitude;
//海拔标准
const CFStringRef kCGImagePropertyGPSAltitudeRef;
//海拔高度
const CFStringRef kCGImagePropertyGPSAltitude;
//时间戳
const CFStringRef kCGImagePropertyGPSTimeStamp;
//测量GPS的卫星
const CFStringRef kCGImagePropertyGPSSatellites;
//GPS状态
const CFStringRef kCGImagePropertyGPSStatus;
//测量模式
const CFStringRef kCGImagePropertyGPSMeasureMode;
//精度数据
const CFStringRef kCGImagePropertyGPSDOP;
//速度标准
const CFStringRef kCGImagePropertyGPSSpeedRef;
//速度
const CFStringRef kCGImagePropertyGPSSpeed;
//运动方向参考
const CFStringRef kCGImagePropertyGPSTrackRef;
//运动方向
const CFStringRef kCGImagePropertyGPSTrack;
//位置方向参考
const CFStringRef kCGImagePropertyGPSImgDirectionRef;
//位置方向
const CFStringRef kCGImagePropertyGPSImgDirection;
//地图测量数据
const CFStringRef kCGImagePropertyGPSMapDatum;
//地理纬度南纬或北纬
const CFStringRef kCGImagePropertyGPSDestLatitudeRef;
//地理纬度
const CFStringRef kCGImagePropertyGPSDestLatitude;
//地理经度 东经或西经
const CFStringRef kCGImagePropertyGPSDestLongitudeRef;
//地理经度
const CFStringRef kCGImagePropertyGPSDestLongitude;
//方位参照
const CFStringRef kCGImagePropertyGPSDestBearingRef;
//地理方位
const CFStringRef kCGImagePropertyGPSDestBearing;
//距离参照
const CFStringRef kCGImagePropertyGPSDestDistanceRef;
//距离
const CFStringRef kCGImagePropertyGPSDestDistance;
//查找地理位置的方法
const CFStringRef kCGImagePropertyGPSProcessingMethod;
//GPS地区名
const CFStringRef kCGImagePropertyGPSAreaInformation;
//日期时间
const CFStringRef kCGImagePropertyGPSDateStamp;
//校正信息
const CFStringRef kCGImagePropertyGPSDifferental;
//错误信息
const CFStringRef kCGImagePropertyGPSHPositioningError;
kCGImagePropertyIPTCDictionary对应的字典中可能包含的键定义如下:
//对象类型
const CFStringRef kCGImagePropertyIPTCObjectTypeReference;
//对象属性
const CFStringRef kCGImagePropertyIPTCObjectAttributeReference;
//对象名称
const CFStringRef kCGImagePropertyIPTCObjectName;
//编辑状态
const CFStringRef kCGImagePropertyIPTCEditStatus;
//更新状态
const CFStringRef kCGImagePropertyIPTCEditorialUpdate;
//紧急等级
const CFStringRef kCGImagePropertyIPTCUrgency;
//主体
const CFStringRef kCGImagePropertyIPTCSubjectReference;
//类别
const CFStringRef kCGImagePropertyIPTCCategory;
//补充类别
const CFStringRef kCGImagePropertyIPTCSupplementalCategory;
//Fixture标识
const CFStringRef kCGImagePropertyIPTCFixtureIdentifier;
//关键字
const CFStringRef kCGImagePropertyIPTCKeywords;
//内容定位码
const CFStringRef kCGImagePropertyIPTCContentLocationCode;
//内容位置名称
const CFStringRef kCGImagePropertyIPTCContentLocationName;
//图像使用的最早日期
const CFStringRef kCGImagePropertyIPTCReleaseDate;
//图像使用的最早时间
const CFStringRef kCGImagePropertyIPTCReleaseTime;
//最后一次使用日期
const CFStringRef kCGImagePropertyIPTCExpirationDate;
//最后一次使用时间
const CFStringRef kCGImagePropertyIPTCExpirationTime;
//图像使用的特别说明
const CFStringRef kCGImagePropertyIPTCSpecialInstructions;
//建议行为
const CFStringRef kCGImagePropertyIPTCActionAdvised;
//服务参考
const CFStringRef kCGImagePropertyIPTCReferenceService;
//日期参考
const CFStringRef kCGImagePropertyIPTCReferenceDate;
//参考码
const CFStringRef kCGImagePropertyIPTCReferenceNumber;
//创建日期
const CFStringRef kCGImagePropertyIPTCDateCreated;
//创建时间
const CFStringRef kCGImagePropertyIPTCTimeCreated;
//数字创建日期
const CFStringRef kCGImagePropertyIPTCDigitalCreationDate;
//数字创建时间
const CFStringRef kCGImagePropertyIPTCDigitalCreationTime;
//原始程序
const CFStringRef kCGImagePropertyIPTCOriginatingProgram;
//程序版本
const CFStringRef kCGImagePropertyIPTCProgramVersion;
图像的编辑周期(早晨,晚上或两者)。
const CFStringRef kCGImagePropertyIPTCObjectCycle;
//不想创建者名称
const CFStringRef kCGImagePropertyIPTCByline;
//图像创建标题
const CFStringRef kCGImagePropertyIPTCBylineTitle;
//城市信息
const CFStringRef kCGImagePropertyIPTCCity;
//城市内位置
const CFStringRef kCGImagePropertyIPTCSubLocation;
//省份
const CFStringRef kCGImagePropertyIPTCProvinceState;
//国家编码
const CFStringRef kCGImagePropertyIPTCCountryPrimaryLocationCode;
//国家名称
const CFStringRef kCGImagePropertyIPTCCountryPrimaryLocationName;
//OriginalTransmission参考
const CFStringRef kCGImagePropertyIPTCOriginalTransmissionReference;
//图像内容摘要
const CFStringRef kCGImagePropertyIPTCHeadline;
//提供图像服务的名称
const CFStringRef kCGImagePropertyIPTCCredit;
//图像源
const CFStringRef kCGImagePropertyIPTCSource;
//公司提示
const CFStringRef kCGImagePropertyIPTCCopyrightNotice;
//联系人
const CFStringRef kCGImagePropertyIPTCContact;
//描述
const CFStringRef kCGImagePropertyIPTCCaptionAbstract;
//图像编辑者
const CFStringRef kCGImagePropertyIPTCWriterEditor;
//图像类型
const CFStringRef kCGImagePropertyIPTCImageType;
//方向信息
const CFStringRef kCGImagePropertyIPTCImageOrientation;
//语言信息
const CFStringRef kCGImagePropertyIPTCLanguageIdentifier;
//星级
const CFStringRef kCGImagePropertyIPTCStarRating;
//联系人详细信息
const CFStringRef kCGImagePropertyIPTCCreatorContactInfo;
//图像使用权限
const CFStringRef kCGImagePropertyIPTCRightsUsageTerms;
//场景代码
const CFStringRef kCGImagePropertyIPTCScene;
上面的kCGImagePropertyIPTCCreatorContactInfo对应的字典中键的定义如下:
//联系人城市
const CFStringRef kCGImagePropertyIPTCContactInfoCity;
//联系人国家
const CFStringRef kCGImagePropertyIPTCContactInfoCountry;
//联系人地址
const CFStringRef kCGImagePropertyIPTCContactInfoAddress;
//邮编
const CFStringRef kCGImagePropertyIPTCContactInfoPostalCode;
//省份
const CFStringRef kCGImagePropertyIPTCContactInfoStateProvince;
//电子邮件
const CFStringRef kCGImagePropertyIPTCContactInfoEmails;
//电话
const CFStringRef kCGImagePropertyIPTCContactInfoPhones;
//网址
const CFStringRef kCGImagePropertyIPTCContactInfoWebURLs;
kCGImageProperty8BIMDictionary对应的字典中可能包含的键定义如下:
//Photoshop文件的图层名
const CFStringRef kCGImageProperty8BIMLayerNames;
//版本
const CFStringRef kCGImageProperty8BIMVersion;
kCGImagePropertyDNGDictionary对应的字典中可能包含的键定义如下:
//DNG版本
const CFStringRef kCGImagePropertyDNGVersion;
//兼容的最老版本
const CFStringRef kCGImagePropertyDNGBackwardVersion;
//摄像机模型
const CFStringRef kCGImagePropertyDNGUniqueCameraModel;
const CFStringRef kCGImagePropertyDNGLocalizedCameraModel;
//相机序列码
const CFStringRef kCGImagePropertyDNGCameraSerialNumber;
//镜头信息
const CFStringRef kCGImagePropertyDNGLensInfo;
//黑度等级
const CFStringRef kCGImagePropertyDNGBlackLevel;
//白度等级
const CFStringRef kCGImagePropertyDNGWhiteLevel;
const CFStringRef kCGImagePropertyDNGCalibrationIlluminant1;
const CFStringRef kCGImagePropertyDNGCalibrationIlluminant2;
const CFStringRef kCGImagePropertyDNGColorMatrix1;
const CFStringRef kCGImagePropertyDNGColorMatrix2;
const CFStringRef kCGImagePropertyDNGCameraCalibration1;
const CFStringRef kCGImagePropertyDNGCameraCalibration2;
const CFStringRef kCGImagePropertyDNGAsShotNeutral;
const CFStringRef kCGImagePropertyDNGAsShotWhiteXY;
const CFStringRef kCGImagePropertyDNGBaselineExposure;
const CFStringRef kCGImagePropertyDNGBaselineNoise;
const CFStringRef kCGImagePropertyDNGBaselineSharpness;
const CFStringRef kCGImagePropertyDNGPrivateData;
const CFStringRef kCGImagePropertyDNGCameraCalibrationSignature;
const CFStringRef kCGImagePropertyDNGProfileCalibrationSignature;
const CFStringRef kCGImagePropertyDNGNoiseProfile;
const CFStringRef kCGImagePropertyDNGWarpRectilinear;
const CFStringRef kCGImagePropertyDNGWarpFisheye;
const CFStringRef kCGImagePropertyDNGFixVignetteRadial;
kCGImagePropertyCIFFDictionary对应的字典中可能包含的键定义如下:
//相机信息
const CFStringRef kCGImagePropertyCIFFDescription;
//固件版本
const CFStringRef kCGImagePropertyCIFFFirmware;
//所有者名称
const CFStringRef kCGImagePropertyCIFFOwnerName;
//图片名
const CFStringRef kCGImagePropertyCIFFImageName;
//图片文件名
const CFStringRef kCGImagePropertyCIFFImageFileName;
//曝光方式
const CFStringRef kCGImagePropertyCIFFReleaseMethod;
//曝光时间
const CFStringRef kCGImagePropertyCIFFReleaseTiming;
//RecordID
const CFStringRef kCGImagePropertyCIFFRecordID;
//曝光时间
const CFStringRef kCGImagePropertyCIFFSelfTimingTime;
//相机序列号
const CFStringRef kCGImagePropertyCIFFCameraSerialNumber;
//图片编码
const CFStringRef kCGImagePropertyCIFFImageSerialNumber;
//驱动模式
const CFStringRef kCGImagePropertyCIFFContinuousDrive);
//焦点模式
const CFStringRef kCGImagePropertyCIFFFocusMode;
//测量模式
const CFStringRef kCGImagePropertyCIFFMeteringMode;
//曝光模式
const CFStringRef kCGImagePropertyCIFFShootingMode;
//透镜模式
const CFStringRef kCGImagePropertyCIFFLensModel;
//最长镜头长度
const CFStringRef kCGImagePropertyCIFFLensMaxMM;
//最短镜头长度
const CFStringRef kCGImagePropertyCIFFLensMinMM;
//白平衡等级
const CFStringRef kCGImagePropertyCIFFWhiteBalanceIndex;
//曝光补偿
const CFStringRef kCGImagePropertyCIFFFlashExposureComp;
//实测曝光值
const CFStringRef kCGImagePropertyCIFFMeasuredEV);
六、ImageIO框架在实际开发中的几个应用
1.显示特殊格式的图片
在平时开发中,我们通常使用UIImage来读取图片,UIImage支持的图片包括png与jpg等,但是类似windows系统的ico图标,UIImage默认是无法显示的,可以通过ImageIO框架来在iOS系统中使用ico图标,示例如下:
NSString * path = [[NSBundle mainBundle]pathForResource:@"image" ofType:@"ico"];
NSURL * url = [NSURL fileURLWithPath:path];
CGImageRef myImage = NULL;
CGImageSourceRef myImageSource;
CFDictionaryRef myOptions = NULL;
myImageSource = CGImageSourceCreateWithURL((CFURLRef)url, NULL);
myImage = CGImageSourceCreateImageAtIndex(myImageSource,
0,
NULL);
CFRelease(myImageSource);
UIImageView * image = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
image.image = [UIImage imageWithCGImage:myImage];
2.读取数码相机拍摄图片的地理位置、时间等信息
3.对相册中图片的地理位置,时间等信息进行自定义修改。
4.将自定义格式的图片数据写入本地文件。
5.展示GIF动图
详情见博客:https://my.oschina.net/u/2340880/blog/608560。
6.渐进渲染大图
渐进渲染技术在对加载大图片时特别重要,你应该使用过地图软件,地图视图在加载时是局部进行加载,当移动或者放大时,地图会一部分一部分的渐进进行加载,使用ImageIO框架可以实现大图渐进渲染的效果,一般在对大图片进行网络请求时,可以获取一部分数据就加载一部分数据,为了便于演示,博客中使用定时器来默认网络返回数据,代码示例如下:
@interface ViewController ()
{
NSMutableData * _data;
NSData * _allData;
NSUInteger length;
UIImageView * _imageView;
NSTimer * timer;
NSInteger le;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_data = [[NSMutableData alloc]init];
NSString * path = [[NSBundle mainBundle]pathForResource:@"Default-Portrait-ns@2x" ofType:@"png"];
_allData = [NSData dataWithContentsOfFile:path];
length = _allData.length;
le = length/10;
timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(updateImage) userInfo:nil repeats:YES];
_imageView = [[UIImageView alloc]initWithFrame:self.view.frame];
[self.view addSubview:_imageView];
}
-(void)updateImage{
static int index = 0;
if (index==10) {
return;
}
NSUInteger l;
if (index==9) {
l=length-le*9;
}else{
l= le;
}
Byte by[l];
[_allData getBytes:by range:NSMakeRange(index*le, l)];
[_data appendBytes:by length:l];
CGImageSourceRef myImageSource = CGImageSourceCreateWithData((CFDataRef)_data, NULL);
CGImageRef myImage = CGImageSourceCreateImageAtIndex(myImageSource,
0,
NULL);
CFRelease(myImageSource);
_imageView.image = [UIImage imageWithCGImage:myImage];
// image.image = [UIImage imageNamed:@"image.ico"];
index++;
}
@end
效果如下: