CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

JYImageTool 2.1

JYImageTool 2.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2017

Maintained by Job-Yang.



       

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)

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..
}

Installation

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..
}

安装

手动安装

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

许可证

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