You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this library. However, I seem to have issues using the trimming utility. I assign a UIColor with RGB colour space, but it doesn't actually trim the image.
Here's an example of an image I am trying to trim:
I'm wanting to trim the black borders on the top and bottom, so I set the UIColor to [UIColor colorWithRed:0 green:0 blue:0 alpha:1]] but I am returned the exact same image, nothing is being trimmed.
The text was updated successfully, but these errors were encountered:
I believe the problem is that starting right here the code assumes that black and white are represented with 4 components like all the other colors in the RGBA colorspace. After debugging and hunting around I figured out that black and white are represented by a seemingly undocumented color space kCGColorSpaceDeviceGray which causes this to evaluate to true: CGColorGetNumberOfComponents([UIColor black].CGColor) == 2
Because of this, line 40 returns NULL. Additionally, the assumptions made in line 48 will not produce the expected outcome when trying to crop out black or white borders.
I hacked together a UIImage category today that I believe handles this issue correctly. I intend to expand upon it to be more full featured for use in an app I am working on, but feel free to borrow and/or contribute back!
Thanks for this library. However, I seem to have issues using the trimming utility. I assign a
UIColor
with RGB colour space, but it doesn't actually trim the image.Here's an example of an image I am trying to trim:
I'm wanting to trim the black borders on the top and bottom, so I set the
UIColor
to[UIColor colorWithRed:0 green:0 blue:0 alpha:1]]
but I am returned the exact same image, nothing is being trimmed.The text was updated successfully, but these errors were encountered: