Core Image black fringes

That's a subtle one. When rotating a CIImage with [CIImage imageByApplyingTransform:t], you'll see incorrect blending between the image and its background. In this case, a black and grey image on a red background shows darker interpolated pixels than exist in both image and background.

Image:Core Image black fringes - CIAffineClamp and CICrop.png

Core Image is by default assuming a black border when blending the image. CIAffineClamp mentions black fringes when using a Gaussian Blur — when blurring, Core Image will blend border pixels with black. Adding CIAffineClamp will extend the image infinitely to blur border pixels with a copy of themselves.

Any filter that starts blending out-of-image pixels will benefit from CIAffineClamp — this will remove black borders in CICrystallize, CIPointillize, … and all the blur filters.

Dan Wood
2010 02 27

Yeah, affine clamp is your friend! We use it in Sandvox for scaling images so that the scaled images have opaque edges - otherwise the fractional edge pixels will be translucent. Similar to the above transform and blurring issue.

(BTW, your blog commenting input system is not handling HTML entities properly... if one tries to enter an ampersand here, the comment will be rejected.)

Patrick Geiller
2010 02 27

Ah, I didn't try the scaling yet. Good to know it's also useful there.

(& thanks for the bug report !)

Follow me on Twitter
Planet Cocoa

2011 02 22Distance field
2010 07 202Binding through NSApp
2010 05 122Forwarding invocations
2010 02 272Core Image black fringes
2010 02 21Quickest Way to Shell
2010 02 08Who's calling ?
2009 09 2138 ways to use Blocks in Snow Leopard
2009 08 182Bracket Mess
2009 08 124Taming JavascriptCore within and without WebView
2009 04 15Debugging with Activity Monitor
2009 03 25How Core Image Color Tracking works
2009 03 1510Custom NSThemeFrame
2009 03 10Which framework is running ?
2009 03 074CoreUI can paint pretty big
2009 02 18Localization with functions
2009 01 30Did you forget to nest alloc and init?
2009 01 16JSCocoa on the iPhone
2009 01 11Mixing WebView and JavascriptCore
2009 01 09Badge overflow
2009 01 09Find your Garbage Collection leaks with Instruments

Powered by MediaWiki