123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //
- // UIImage+Extension.h
- // HuaKaiChat
- //
- // Created by BigBiao on 2017/9/16.
- // Copyright © 2017年 huakai. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- @interface UIImage (Extension)
- //获取屏幕截图
- + (UIImage *)screenshot;
- //切除图片的边角
- - (UIImage*)imageWithSize:(CGSize)size cornerRadius:(CGFloat)corner rectCornerType:(UIRectCorner)cornerType;
- //裁剪图片
- + (UIImage *)cutImage:(UIImage*)image isDT:(BOOL)flag;
- //根据视频URL地址,截取第一帧图片
- + (UIImage *)imageWithVideo:(NSURL *)videoURL;
- //根据颜色值拉伸成图片
- + (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size;
- //设置图片的透明度
- - (UIImage *)imageByApplyingAlpha:(CGFloat)alpha;
- //给图片加水印
- + (instancetype)waterImageWithBg:(UIImage*)bgImg centerImg:(NSString *)centerImg;
- //获取屏幕图片
- + (nullable UIImage*)screenView:(UIView *)view;
- + (UIImage *)imageWithScreenshot;
- //在图片最中间添加水印图片
- //循环压缩图片到制定大小
- - (NSData *)compressImageToMaxFileSize:(NSInteger)maxFileSize;
- //压到指定大小而且最大宽高小于1280
- +(NSData *)zipNSDataWithImage:(UIImage *)sourceImage maxFileSize:(NSInteger)maxFileSize;
- //图片压缩到指定大小1280*1280内
- - (UIImage*)imageByScalingAndCroppingForSize:(CGSize)targetSize;
- @end
- //毛玻璃效果
- @interface UIImage (ImageEffects)
- - (UIImage *)applyLightEffect;
- - (UIImage *)applyExtraLightEffect;
- - (UIImage *)applyDarkEffect;
- - (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor;
- //base init 方法
- //radius 是模糊处理半径,值越大,越模糊。
- //tintColor 遮盖层的颜色值
- //saturationDeltaFactor 色彩饱和度0是黑白色,1是原色,9代表最鲜艳,默认1.8
- //maskImage 遮盖图片 给nil
- - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage;
- //设置圆形图片
- - (UIImage *)cutCircleImage;
- //高斯模糊
- +(UIImage *)boxblurImage:(UIImage *)image withBlurNumber:(CGFloat)blur;
- @end
|