In the digital age, analog film as a photographic medium almost went extinct, and many variants did. We can’t make them again, we don’t have the technology. But somehow some survived and are actually on the upward trend. Film is a phenomenon, a century-plus-old medium seems to have developed a modern cult following. But it comes at a high cost for the film itself, the development, and the digital scanning that is required to post that image to Instagram. So how do we get that Lofi film vibe in pure digital?
You fake it using digital image processing! But first, if we want to faithfully emulate the look, we need to understand the science behind what gives films that distinctive look.
Science of Film Grain
I found a wonderful video by SmaterEveryDay that goes into the magic behind analog film and explains, in detail, how the process works.
With this in mind, we can start trying to replicate that grainy look on a digital image.
Research
This is the stuff that takes the bulk of my time, finding all of the information that I can to understand the mechanics of film grain synthesis. There are about a million different ways to tackle this problem, but I needed to constrain my version to what is possible to implement on iOS. This section is mostly notes but feel free to go into the reading if you are curious.
This article goes into why the problem is much more difficult than adding noise to an image. There is nuance to film grain, it looks different from the digital noise you get when increasing your camera’s ISO setting.
PetaPixel: Why Adding ‘Film Grain’ to Digital Photos is Trickier Than You May Think
This article digs deeper into the simulated film grain process and gives some examples of different software implementations. Expanding on the area of Film emulation.
DIY Photography: DIGGING EVEN DEEPER INTO THE SIMULATED DIGITAL GRAIN RABBIT HOLE
The company Dehancer came up frequently when I was investigating film grain plugins and software. They have an excellent article on how to use their plugin, what all the terms are, and how they affect your image. I used this as a reference for some of the variables I could use in my app to manage the look of different grains.
Dehancer Blog: How does film grain work in Dehancer OFX plugin
Journal Papers
I also looked into if there were any journal papers on film grain simulation. These two are from the same author but go into different aspects of the algorithm they invented. I didn’t directly implement these methods but I used them as inspiration for my grain rendering algorithm.
Realistic Film Grain Rendering
Alasdair Newson, Noura Faraj, Julie Delon, Bruno Galerne, Realistic Film Grain Rendering, Image Processing On Line, 7 (2017),
pp. 165–183. https://doi.org/10.5201/ipol.2017.192
A Stochastic Film Grain Model for Resolution-Independent Rendering
A Newson, Julie Delon, B Galerne. A Stochastic Film Grain Model for Resolution-Independent Rendering. Computer Graphics Forum, 2017. hal-01520260. https://hal.science/hal-01520260v1
This method looks like it recreates the image using different size overlapping grains and you can see, in the figures I selected, when you zoom in the harsh edges fade away and you can see how they are built up of small particles.
Other interesting research
Another area that I stumbled across, is the effect of film grain on video compression for high-bandwidth streaming services. Film grain is functionally equivalent to wide bandwidth noise that is hard to encode and compress effectively. So companies are removing the grain from the original and adding back simulated grain on the client side of the data transfer. This means that accurate profiling of the grain parameters and effects is necessary to emulate it in software.
By Dan Grois, Alex Giladi, Thomas Guionnet, Thomas Burnichon,
Nikolay Tverdokhleb, and Mickael Raulet
Without the grain original media looks very different and can give classic films a weird feel. So this idea of film grain synthesis spans more areas than I initially thought.
Secret Sauce
Film grain software is a big business. Everyone has their own blend of secrets to get a natural look. But there are also companies that scan real film and use that as an overlay. Two companies that seem to be producing good results are HolyGrain, for film scans and overlays for images and video, and Dehancer for more film emulation plugins and even an iOS app.
But I can’t use those in my app, so I need to somehow make my own. But that doesn’t mean I can’t learn from them.
Building My Own
One of the first things that you see when you google how to simulate film on iOS is some developer documentation for simulating scratchy analog film. This is a pretty good start to the coding process and how to use the built-in filters that Apple provides for image manipulation but when you try and use it for high-resolution images you start to see the flaws quickly.
Apple Developer Docs: Simulating Scratchy Analog Film
This is because the random variation used in the CIFilter library is actually not random at all. It is a static 512×512 pixel image that can be extended indefinitely. That replication creates unwanted patterns in the resulting high-resolution image.
Once I realized that I switched to a scanned film grain overlay. It has good texture but the sharpness of the iPhone lens makes it look a bit too fake. For that overlay, I used the Soft light method of blending.
Wholegrain Technology (TM)
Ok, so I decided to create my own secret sauce recipe for my 36Exp film camera app. This uses a combination of filters available in the iOS filter APIs and advanced metal rendering algorithms to produce a highly realistic film grain look in real-time. This technology is able to emulate film grain size as a function of the image resolution. Which means it has this analog-like softness while maintaining detail.
Here are two zoomed-in images showing the finest and the largest grain setting. We can see significant differences in the resolving power of the two different grain emulations.
Full-size images to see the overall effect of the grain on the composition. From this aspect, it is much harder to tell the difference between the two images. So keep that in mind if you are posting to Instagram or want a high-resolution print.
The grain density also replicates the effect of shadows and highlights on an analog negative. This means that darker areas of under-exposure look grainier than the highlights.
I also added the ability to change the film grain chroma for color films. This means you can adjust the amount of color noise in the grain. This effect is not present when you select a black-and-white film simulations.
It can be a bit hard to tell on the website but if you download the images for the chroma and zoom in it is much more apparent.
I am calling this method for adding realistic film grain to digital images “Wholegrain Technology (TM)” since it recreates the digital image out of simulated film grains.
Digital Downsides
The issue with this process is that it takes a lot of processing power to re-render an image of high resolution. As you decrease the film grain size more particle analysis needs to be calculated to resolve the image. So it’s a balance between processing time and a realistic film look.
Generating the random variables to reduce patterns in the film grain is also complicated. This is because any computer-generated random process is actually just pseudo-random. But there are some tricks we can use with seeding the random process to help the grain look a bit more random than it truly is.
Testing and Comparison
Here is one example of real film vs the Wholegrain emulation in 36Exp. You can see that the real film has a smoother texture than the render, but the render exhibits the same soft features and granulation of the edges. The highlights of the film also have a bit more grain to them. I suspect this is because of the higher latitude of the film compared to the iPhone sensor.
If we zoom in on the images we can see that the granulation process of the emulated film looks very close to the real film scan. One area I am looking to improve is the consistency of the emulated grain in transition areas so that it has a more gradual fade than the hard color stops
Conclusions
So why is grain so important to the look of film? I think it is partly for the nostalgia, hearkening back to the physical rather than just digital, and it just gives images more character. I see it as an artistic choice to add grain, just like anything in the editing process, it is about the feeling you want to impart when someone sees the image.
The idea with 36Exp is that you bake in most of the image “look” while you take the photo, similarly to how you choose a film stock before you go out to shoot it. That is the feeling the process of the app is going for. I hope this explanation of the film grain tools in 36Exp inspires you to go out and take some grainy memories.
36Exp App
You can get the full app on the iOS app store now to start creating some of the best film images with your iPhone or iPad.
Get it on the iOS App Store Now!
Extra Resources
- Film grain: the power of nostalgia
- The Beauty of Imperfection: Exploring Film Grain in Analogue Imagery
Subscribe to Tea and Tech Time for Blog posts and Project updates!