<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Brandon Aubrey on Medium]]></title>
        <description><![CDATA[Stories by Brandon Aubrey on Medium]]></description>
        <link>https://medium.com/@baubrey91?source=rss-b758eeed8849------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4WG7IJIF_eQppC7F</url>
            <title>Stories by Brandon Aubrey on Medium</title>
            <link>https://medium.com/@baubrey91?source=rss-b758eeed8849------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 10:50:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@baubrey91/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating a Retro Game Photo Filter]]></title>
            <link>https://baubrey91.medium.com/creating-a-retro-game-photo-filter-ef003e51411f?source=rss-b758eeed8849------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef003e51411f</guid>
            <category><![CDATA[8-bit]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Brandon Aubrey]]></dc:creator>
            <pubDate>Wed, 12 Mar 2025 04:42:41 GMT</pubDate>
            <atom:updated>2025-03-12T04:42:41.211Z</atom:updated>
            <content:encoded><![CDATA[<p>Years ago, I had the idea of creating a photo filter that could transform any image into a retro, 8-bit ‘GameBoy’ style image. After putting it off for quite some time, I finally decided to dive into the project. The process was straightforward, but the results were incredibly satisfying. In this article, I’ll walk you through the steps of transforming a photo into a pixelated 8-bit masterpiece with four shades of green, reminiscent of the classic GameBoy screen.</p><p><strong>Solutions for image processing</strong></p><p>Here were a few of the pros and cons of some ways you can process an image. Keep in mind there are other solutions, and each solution has a purpose even if it wasn’t used for this project.</p><p><em>Metal framework</em></p><ul><li>Uses GPU for much faster processing</li><li>Very complex</li><li>Low-Level</li><li>Custom Kernels use a different language</li></ul><p><em>Accelerate framework</em></p><ul><li>High-speed math calculation</li><li>A bit of a learning curve</li><li>Can be used in combination with CoreImage</li></ul><p><em>Core Image</em></p><ul><li>Simple to use</li><li>Offloads to GPU</li><li>Built-in Filters that are easy to implement</li></ul><p><em>Core Graphics</em></p><ul><li>Primarily for custom graphics</li><li>Uses Paths for drawing and rendering</li></ul><p><em>CoreML(for creating a filter)</em></p><ul><li>Requires training a model, which adds complexity but can lead to highly personalized results.</li></ul><p>The original gameboy has a screen of 160 x 144 pixels so first I wanted to crop the image to fit that ratio.</p><p>This also helps make the image have less data which will help us later when we process it. When displaying images in swift we can use different modifiers that adjust the ratio but it doesn’t actually change the data of the image. Take for example this code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*ucttNkkTZRK_umK4u4JgAw.png" /></figure><p>The image will be resized but the original image will not be modified. I needed to actually crop out the image I have to the proper dimensions I want (160 X 144).</p><p>To crop the image to fit the 160x144 Game Boy screen size, I used <strong>Core Graphics</strong> to crop the image based on its dimensions. By checking if the image was wider or taller than the target ratio, I calculated the necessary cropping area. After determining the region to crop, I created the appropriate CGRect and used the CGContextDrawImage() function to actually perform the cropping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Zs4AJUO121jzVm0Q2l3IA.png" /></figure><p>Now comes the fun part. I needed to “pixelate” my image and dither. Dithering is a very interesting process I learned on my adventure about how we can optimize how images look. Since this image will only have 4 shades of green it can be hard to really show shadowing. When colors start and end can be a bit jarring. See the two photos below when iterating over and matching the pixel with the closest of the 4 shades of green.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*X8nL6IuN10BiVrM3LnVqNg.png" /><figcaption>Original</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*1ihXfQ6hUuo82Do06sgeug.png" /><figcaption>Colored and not dithered</figcaption></figure><p>Dithering is a technique used to create the illusion of colors or shading that aren’t present in the image palette. Since I was reducing the image to only 4 shades of green (to mimic the Game Boy’s limited screen), dithering helps make transitions between colors less harsh by spreading color errors to surrounding pixels. This allows for a smoother gradation between the shades. I used the <strong>Floyd-Steinberg Dithering</strong> algorithm, which works by calculating the error between the original pixel value and the new pixel value, and then spreading that error to neighboring pixels, resulting in a more natural look.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*AADLg9OvCYX6FFH86x5vXw.png" /></figure><p>Lucky for me I did not need to build my own dither algorithm. I was able to use the Accelerate framework which had a built dithering functions. To convert the image to the 8-bit style, I worked with two types of image formats: <strong>Planar8</strong> and <strong>Planar2</strong>. <strong>Planar8</strong> refers to an image format where each pixel can have 256 color values (8-bit), while <strong>Planar2</strong> is a more restricted format, using only 2 bits per pixel. This results in just 4 possible colors, which is exactly what we need for the 4 shades of green on a Game Boy screen. The only downside is it’s 4 shades of gray. During this time I also changed the buffer size of the image to match my 160x144 dimensions and pass in what dithering style I want done. This pixelates things as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*JIL8udtBvPueVb7gzBkotQ.png" /><figcaption>Processed but not colored</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j6xkFeHONPxFWnWAYTBl2A.png" /></figure><p>After the dithering and pixelation process, the image was still in shades of gray. The final step was to colorize the image. Using <strong>Core Graphics</strong>, I iterated over each pixel in the image and mapped it to one of the 4 shades of green I had chosen for the Game Boy look. This was done by creating a buffer of all the pixels and mapping each one to the closest shade of green.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AzqSvYpCZb01cdlnPzVq1w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*nlZRMML4q4TUt1KiBjx89A.png" /></figure><p>For the UI, I designed a layout that resembled a classic handheld gaming system. The A button processes the image, the B button undoes the changes, and the directional pad allows users to adjust contrast and brightness. The Select/Start buttons handle importing and exporting the images. It was a fun challenge to recreate the gaming interface and integrate it with the image processing functionalities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DIpQNTgdtb9TLM178-nI1Q.png" /></figure><p>This project was a fun exploration of image processing, and it was fascinating to experiment with different frameworks before settling on the final solution. I encourage you to try out the app and perhaps even explore some of the other image processing techniques. The beauty of development is that there are always many ways to approach a problem, and finding the one that suits your needs best is a rewarding journey.</p><p><strong>Download the app here</strong>: <a href="https://apps.apple.com/us/app/pxlboy/id6742595672">https://apps.apple.com/us/app/pxlboy/id6742595672</a></p><p><strong>See the source code here</strong>: https://github.com/baubrey91/PixelBoy</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef003e51411f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The battle of dependency managers]]></title>
            <link>https://baubrey91.medium.com/the-battle-of-dependency-managers-e0fddb198234?source=rss-b758eeed8849------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0fddb198234</guid>
            <category><![CDATA[carthage]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift-package-manager]]></category>
            <category><![CDATA[cocoapods]]></category>
            <category><![CDATA[dependency-management]]></category>
            <dc:creator><![CDATA[Brandon Aubrey]]></dc:creator>
            <pubDate>Sun, 14 Feb 2021 01:16:17 GMT</pubDate>
            <atom:updated>2021-02-14T01:16:17.659Z</atom:updated>
            <content:encoded><![CDATA[<p>Which dependency manager have we used at Tubi? CocoaPods, Carthage, or Swift Package Manager (SPM)? The answer is all of them. First let’s start by explaining what a dependency manager is. Suppose you want your application to do something a million other developers have already done like networking, show a spinner, logging, or even crash reports. Why re-invent the wheel when others have already perfected it and put the code into shareable open source libraries you are allowed to use for free? Great so just copy and past the code into my code base right? But what if the author makes changes to fix bugs, or you don’t want more code to look at in your workspace? This is why we have dependency managers, to allow us to manage which dependency and version we want in you project.</p><p>Ok, ok but which one do I use? Well you use the right too for the right job. Let’s take a high level overview of all three.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*RRPh6bNodf2h4qDX.jpg" /></figure><p><strong>CocoaPods Pros — </strong>Easy to use, Widely used (most third party libraries supports it), Easy to use site to look up libraries</p><p><strong>CocoaPods Cons — </strong>Centralized, Longer build times, Not supported by Apple</p><p><strong>Carthage Pros — </strong>Fast, Supports binary libraries, Decentralized</p><p><strong>Carthage Cons — </strong>Hard to maintain (Setup and debugging), Less third party libraries support Carthage, Not supported by Apple</p><p><strong>SPM Pros — </strong>Supported by Apple, Easy to use interface, Decentralized</p><p><strong>SPM Cons — </strong>Does not support binaries(yet), Not all libraries support SPM(yet), Very new (but apple is ramping up quickly)</p><p>When I first joined Tubi we were using CocoaPods, which was actually the only dependency manager I had ever used. Super easy to use with simple one line commands to install, update, upgrade etc in your workspace. But then our team decided to be adventurous and try Carthage as it is decentralized and can create shorter build times. See CocoaPods keeps all the libraries supported by them in one place, while Carthage will reach out directly to the repo to get it. This causes for longer set up time when using CocoaPods. After migrating our libraries over to Carthage (which included doing some hacks to get certain libraries over) I believe we saved almost 20 minutes on our build time. This can be a huge win if you have a CI like travis that charges by the minute via credits. One large reason for the decrease in time was Carthage can support binary libraries. However we now needed to individually configure each library, and when there were problems it was no fun fixing them. Constants hours of clearing Carthage caches, re-building, and debugging. After hours of dev time being devoted into debugging Carthage we decided to see if there was an alternative. So we decided to investigate the new kid on the block, Swift Package Manager.</p><p>Swift Package Manager, or SPM for short, is the official package manager made by Apple. It comes complete with a very easy to use UI for adding and specifying dependencies in Xcode since it is supported by Apple. So we decided to give it a try. Our first issue we ran into was that SPM is new. Because of this not all creators have updated their libraries to support SPM yet, including some smaller libraries we use which haven’t had updates in years, and will most likely never support SPM. Additionally we use specific versions of some libraries as we have not updated our code to work properly with the latest version. For these reason alone we couldn’t move everything over to SPM yet but we decided to try a hybrid half Carthage half SPM approach.</p><p>Setting up SPM was a breeze, however the real issue we ran into our build time. It had increased 😳! After many days looking into caching properly with Travis, and troubleshooting any issues we realized the SPM build would always take a few minutes long than using just Carthage because SPM does not support Binary libraries (At the time of writing this article that is).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/0*HqbRdnxj0Ej39FUL.jpg" /></figure><p>While SPM is clearly the future, sometimes it is not wise to run to the shiny new things. The SPM team has been working really hard and adding new functionality each year but SPM might not be the best solution for us yet. To summarize which manager is best for you project depends a lot on your project, team, and future. If you projects libraries are all supported by Carthage and you don’t mind getting a little dirty debugging time to time, Carthage might be good for you. If you just want something straight out the box to work and not worry about later CocoaPods might be great for you although in the future it is possible more libraries will only support SPM. If you want to try the latest and greatest and be ready for the future, but keep in mind you favorite libraries may not be supported yet. There is no doubt in my mind SPM will the the default go to but as of now it might not be the perfect solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0fddb198234" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>