{"id":46820,"date":"2025-02-24T16:20:56","date_gmt":"2025-02-24T21:20:56","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=46820"},"modified":"2025-02-24T16:20:56","modified_gmt":"2025-02-24T21:20:56","slug":"cifilterbuiltins","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2025\/02\/24\/cifilterbuiltins\/","title":{"rendered":"CIFilterBuiltins"},"content":{"rendered":"<p><a href=\"https:\/\/blog.eternalstorms.at\/2025\/02\/13\/how-to-use-built-in-core-image-filters-the-easy-way\/\">Matthias Gansrigler<\/a>:<\/p>\n<blockquote cite=\"https:\/\/blog.eternalstorms.at\/2025\/02\/13\/how-to-use-built-in-core-image-filters-the-easy-way\/\"><p>Browsing the Core Image headers, I did find functions for these filters where you could just call <code>let filter = CIFilter.colorPosterize()<\/code><\/p><p>Yet every time I tried, it never worked and would give me an error that <code>CIFilter has no member 'colorPosterize'<\/code>. Well, &ldquo;<em>Crap!<\/em>&rdquo;, I thought, this must be something that will become available eventually.<\/p><p>How wrong I was. This has been available for a while, you just need to know how to do it! The &ldquo;trick&rdquo; is to not only <code>import CoreImage<\/code>, but also (<strong><em>why!?<\/em><\/strong>) <code>import CoreImage.CIFilterBuiltins<\/code>.<\/p><\/blockquote>\n<p><a href=\"https:\/\/developer.apple.com\/documentation\/coreimage\/cifilter\">Apple<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/documentation\/coreimage\/cifilter\"><p>The type-safe approach returns a non-optional filter. Because the returned filter conforms to the relevant protocol&mdash;for example, <a href=\"https:\/\/developer.apple.com\/documentation\/coreimage\/cifalsecolor\"><code>CIFalseColor<\/code><\/a> in the case of <a href=\"https:\/\/developer.apple.com\/documentation\/coreimage\/cifilter\/3228325-falsecolor\"><code>falseColor()<\/code><\/a>&mdash;the parameters are available as properties.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Matthias Gansrigler: Browsing the Core Image headers, I did find functions for these filters where you could just call let filter = CIFilter.colorPosterize()Yet every time I tried, it never worked and would give me an error that CIFilter has no member 'colorPosterize'. Well, &ldquo;Crap!&rdquo;, I thought, this must be something that will become available eventually.How [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2025-02-24T21:20:58Z","apple_news_api_id":"feacd428-7888-4655-9723-2bd820c51f22","apple_news_api_modified_at":"2025-02-24T21:20:59Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A_qzUKHiIRlWXIyvYIMUfIg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[220,31,2586,30,2598,71,901],"class_list":["post-46820","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-coreimage","tag-ios","tag-ios-18","tag-mac","tag-macos-15-sequoia","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/46820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=46820"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/46820\/revisions"}],"predecessor-version":[{"id":46821,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/46820\/revisions\/46821"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=46820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=46820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=46820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}