Skip to content
This repository has been archived by the owner on Feb 27, 2018. It is now read-only.
/ UIImageTrim Public archive
forked from Rychu/UIImage-Trim

Category for trimming transparent pixels of an UIImage object.

Notifications You must be signed in to change notification settings

gizmosachin/UIImageTrim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIImage-Trim

Category for trimming transparent pixels of an UIImage object.

How to use

Add UIImage+Trim to your project with Cocoapods:

pod 'UIImage-Trim', :git => 'https://github.com/gizmosachin/UIImage-Trim'

Include UIImage+Trim.h in the files where you want to trim your images.

Trimming is pretty straightforward:

[yourImage imageByTrimmingTransparentPixels];

Optionally, you may want to consider any non-opaque pixels as being transparent (for instance, cropping out a light drop shadow). This can be achieved by using the alternate method:

[yourImage imageByTrimmingTransparentPixelsRequiringFullOpacity:YES];

Additionally, if you merely desire to know the UIEdgeInsets of the transparency around the image, you may want to use the following:

[yourImage transparencyInsetsRequiringFullOpacity:YES];

This call works based on the same principles as the "advanced" trim method, with the boolean dictating whether non-opaque pixels should be considered transparent.

This fork adds support for trimming white area around image with given tolerance

[yourImage imageByTrimmingWhitePixelsWithOpacity:VALUE];

where 0 - cut only white, 255 - remove everything

About

Category for trimming transparent pixels of an UIImage object.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 97.7%
  • Ruby 2.3%