save NSImage instance

Save NSimage instance object , file type data  option,dictinary kye and value.

 

NSImageCompressionFactor-->JPEG ->0.0-1.0
Available in Mac OS X v10.0 and later.

NSImageCompressionMethod-->TIFF ->NSTIFFCompression

Identifies an NSNumber object identifying the compression method of the image.
Available in Mac OS X v10.0 and later.

NSImageDitherTransparency-->GIF ->Boolean value (抖动的)
Identifies an NSNumber object containing a boolean that indicates whether the image is dithered.
Available in Mac OS X v10.0 and later.

NSImageInterlaced -->PNG ->NSNumber object containing a Boolean value(交错,交织的)
Identifies an NSNumber object containing a Boolean value that indicates whether the image is interlaced.
Available in Mac OS X v10.0 and later.

NSImageRGBColorTable
Identifies an NSData object containing the RGB color table.
Used only for GIF files. It’s stored as packed RGB. It’s set when reading in and used when writing out.
Available in Mac OS X v10.0 and later.

NSImageEXIFData
Identifies an NSDictionary object containing the EXIF data for the image.
This property is used only when reading or writing JPEG files. The dictionary contains the EXIF keys and values. Th standard dictionary keys (that is, those that are not specific to camera vendors) are identical to those for kCGImagePropertyExifDictionary declared in the CGImageSource API. See kCGImagePropertyExifDictionary_Keys for details.
Available in Mac OS X v10.4 and later.

NSImageFallbackBackgroundColor
Specifies the background color to use when writing to an image format (such as JPEG) that doesn't support alpha. The color's alpha value is ignored. The default background color, when this property is not specified, is white. The value of the property should be an NSColor object.
Available in Mac OS X version 10.5 and later.

NSImageFrameCount
Identifies an NSNumber object containing the number of frames in an animated GIF file.
This value is used when reading in data.
Available in Mac OS X v10.2 and later.

NSImageGamma
Identifies an NSNumber object containing the gamma value for the image.
Used only for PNG files. The gamma values is a floating-point number between 0.0 and 1.0, with 0.0 being black and 1.0 being the maximum color. It’s set when reading in and used when writing out.
Available in Mac OS X v10.4 and later.

NSImageCurrentFrame
Identifies an NSNumber object containing the current frame for an animated GIF file.
The first frame is 0.
Available in Mac OS X v10.2 and later.

NSImageCurrentFrameDuration
Identifies an NSNumber object containing the duration (in seconds) of the current frame for an animated GIF image.
The frame duration can be a floating-point value. It is used when reading in, but not when writing out.
Available in Mac OS X v10.2 and later.

NSImageProgressive
Identifies an NSNumber object containing a boolean that indicates whether the image uses progressive encoding.
Used only for JPEG files. It’s set when reading in and used when writing out.
Available in Mac OS X v10.4 and later.

NSImageLoopCount
Identifies an NSNumber object containing the number of loops to make when animating a GIF image.
A value of 0 indicates the animation should loop indefinitely. Values should be specified as integer numbers. It is used when reading in but not when writing out the image.
Available in Mac OS X v10.3 and later.

保存不同的格式图片压缩方法,应该指定相应的属性字典

如保存jpeg文件时候:

NSDictionary *imageProps = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:0.8] forKey:NSImageCompressionFactor];

 

如保存tiff文件时候:

NSDictionary *imageProps = [NSDictionary dictionaryWithObject NSTIFFCompressionNone forKey:NSImageCompressionMethod];

 

NSTIFFCompression
These constants represent the various TIFF data-compression schemes supported by NSBitmapImageRep.

typedef enum _NSTIFFCompression {
   NSTIFFCompressionNone = 1,
   NSTIFFCompressionCCITTFAX3 = 3,
   NSTIFFCompressionCCITTFAX4 = 4,
   NSTIFFCompressionLZW = 5,
   NSTIFFCompressionJPEG = 6,
   NSTIFFCompressionNEXT = 32766,
   NSTIFFCompressionPackBits = 32773,
   NSTIFFCompressionOldJPEG = 32865
} NSTIFFCompression;


附加:

        子线程要调用主线程函数,且是否指定等待返回:

          在线程中:[self performSelectorOnMainThread:@selector(setPreviewImage:) withObject:image waitUntilDone:NO];

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值