• Stars
    star
    381
  • Rank 112,502 (Top 3 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🛠 Useful image tools for iOS

JYImageTool

License MIT  CocoaPods  CocoaPods  Support 

Useful image tools for iOS

Features

  • Extract the primary color of the image(Multiple modes)
  • Extract the image pixel color
  • Contrast image is equal (based on pixel rather than image name)
  • QRcode image generation and recognition
  • Image compression

Usage

Extract the primary color of the image

UIColor *whiteColor = [UIColor colorWithRed:1.f green:1.f blue:1.f alpha:1.f];
// extract bright colors and avoid results if close to white color
self.colorArr = [self.imageView.image extractColorsWithMode:JYExtractModeOnlyDistinctColors avoidColor:whiteColor];

Extract the image pixel color

UIColor *color = [self.imageView.image pixelColorAtLocation:point formImageRect:self.imageView.frame];

Contrast image is equal

BOOL isEqual = [self.imageViewOne.image isEqualToImage:self.imageViewTwo.image];
if (isEqual) {
//...Do something..
}
else {
//...Do something..
}

QRcode image generation and recognition

// Create QRcode image
UIImage *QRcodeImage = [UIImage QRCodeImageFromString:@"Job-Yang" imageSize:500];
// Recognition QRcode in the image
NSString *info = [QRcodeImage identifyQRCode];

Image compression

// Compressed to 500KB
NSData *compressData = [self.originalImage compressImageToByte:500 * 1024];

Installation

CocoaPods

  1. Add pod 'JYImageTool' to your Podfile.
  2. Run pod install or pod update.
  3. Import "JYImageTool.h".

Manually

  1. Download all the files in the JYImageTool subdirectory.
  2. Add the source files to your Xcode project.
  3. Import JYImageTool.h.

License

JYImageTool is released under the MIT license. See LICENSE file for details.


中文介绍

实用的iOS图片工具

特性

  • 图片主色提取(包含多种提取模式)
  • 图片像素点颜色提取
  • 图片相同比较(基于图片像素而非图片名)
  • 二维码图片生成与识别
  • 图片压缩

Usage

图片主色提取

UIColor *whiteColor = [UIColor colorWithRed:1.f green:1.f blue:1.f alpha:1.f];
// 提取较附近更亮的主色,并忽略太接近白色的提取结果
self.colorArr = [self.imageView.image extractColorsWithMode:JYExtractModeOnlyDistinctColors avoidColor:whiteColor];

图片像素点颜色提取

UIColor *color = [self.imageView.image pixelColorAtLocation:point formImageRect:self.imageView.frame];

图片相同比较

BOOL isEqual = [self.imageViewOne.image isEqualToImage:self.imageViewTwo.image];
if (isEqual) {
//...Do something..
}
else {
//...Do something..
}

二维码图片生成与识别

// 创建二维码图片
UIImage *QRcodeImage = [UIImage QRCodeImageFromString:@"Job-Yang" imageSize:500];
// 识别图片中的二维码
NSString *info = [QRcodeImage identifyQRCode];

图片压缩

// 压缩到500KB
NSData *compressData = [self.originalImage compressImageToByte:500 * 1024];

安装

CocoaPods

  1. 在 Podfile 中添加 pod 'JYImageTool' .
  2. 执行 pod installpod update.
  3. 导入 "JYImageTool.h".

手动安装

  1. 下载 JYImageTool 文件夹内的所有内容。
  2. 将 JYImageTool 内的源文件添加(拖放)到你的工程。
  3. 导入 JYImageTool.h

许可证

JYImageTool 使用 MIT 许可证,详情见 LICENSE 文件。