Git Product home page Git Product logo

jyimagetool's Introduction

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 文件。

jyimagetool's People

Contributors

job-yang avatar nrthyrk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.