Skip to content

Instantly share code, notes, and snippets.

View macguru's full-sized avatar

Max Seelemann macguru

View GitHub Profile
@morizotter
morizotter / UIImage+Trim.m
Created September 29, 2015 18:08 — forked from spinogrizz/UIImage+Trim.m
Trim transparent pixels around UIImage
- (UIImage *) imageByTrimmingTransparentPixels {
int rows = self.size.height;
int cols = self.size.width;
int bytesPerRow = cols*sizeof(uint8_t);
if ( rows < 2 || cols < 2 ) {
return self;
}
//allocate array to hold alpha channel