UIImage+Helper.h 1.24 KB
Newer Older
mei's avatar
mei committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
//
//  UIImage+Helper.h
//  CXA
//
//  Created by Xummer on 14-3-3.
//  Copyright (c) 2014年 Xummer. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIImage (Helper)

+ (UIImage *)getThumbnailImage:(UIImage *)image withMaxLen:(CGFloat)maxLen;
- (UIImage *)thumbnailWithMaxLen:(CGFloat)maxLen;

- (UIImage *)imageWithTintColor:(UIColor *)tintColor;

- (UIImage *)imageWithGradientTintColor:(UIColor *)tintColor;

- (UIImage *)imageWithTintColor:(UIColor *)tintColor blendMode:(CGBlendMode)blendMode;

@end

@interface UIImage (Color)
+ (UIImage *)imageWithColor:(UIColor *)color;
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size;
+ (UIImage *)imageWithColor:(UIColor *)color andRect:(CGRect)rect;
- (UIImage *)greyScaleImage;
Sandy's avatar
Sandy committed
29 30 31 32 33 34 35 36 37


/**
 *  图片压缩到指定大小(具体看图片大小,过大的图片无法压缩到指定大小)
 *
 *  @param kb 压缩后图片大小
 *
 *  @return
 */
38
- (NSData *)scaledToSpaceMaxSize:(NSInteger)kb;
Sandy's avatar
Sandy committed
39 40 41 42 43 44 45 46

/**
 *  压缩图片到指定高宽
 *
 *  @param newSize 新的图片尺寸
 *
 *  @return
 */
47
- (UIImage *)scaledToSize:(CGSize)newSize;
Sandy's avatar
Sandy committed
48 49 50 51 52 53 54 55

/**
 *  按比例压缩图片至指定宽度
 *
 *  @param newWidth 指定宽度
 *
 *  @return
 */
56
- (UIImage *)scaledToWidth:(NSInteger)newWidth;
mei's avatar
mei committed
57
@end