Cuatro amigas posando juntas y tomando una selfie al aire libre.

The maths behind Instagram's filters

  • 4 June 2025
  • 4 minutos
  • Blog

With more than 2 billion active users globally, Instagram has become one of the world's leading platforms for digital communication and content generation.

Since its origins, the creative filters it offers to personalise images have been a distinctive element of the platform, contributing decisively to its visual identity and differentiating it from other social networks. Iconic filters such as Clarendon, Juno, Lark, Gingham or Ludwig have become part of the conversation.

But from a technological point of view, Instagram filters are much more than pure aesthetics: every time the Valencia filter is applied to an image, mathematical function transformations are being executed that alter pixel values following pre-designed curves.

Pixels and functions: the mathematical trick behind filters

To understand the science of an Instagram filter, one must first get to know its key players:pixels. A digital photo is made up of millions of tiny coloured dots called pixels, and each pixel is described by numbers. For example, in an RGB (red, green, blue) image, each pixel is actually a triplet of numbers indicating how much red, green and blue intensity it contains (in values ranging from 0 to 255). When you apply a filter, you are actually modifying these numbers using mathematical formulae. 

In the same way that a recipe tells you how to transform different ingredients into a great dinner, a filter tells you how to transform the colours of an image into another style. Some recipes are simple: for example, increasing the brightness of a photo means taking each pixel and increasing its colour values to make everything look lighter (bringing them a little closer to 255, which would be white). Other recipes are more complex, such as changing the tone of the image to make it look like a warmer sunset: in that case the filter mightintensify the red componentof each pixel (e.g. by adding or multiplying by a factor) to create that reddish atmosphere.

Many filters uset one curves or LUTs (Look-Up Tables) to apply more elaborate transformations. Instead of simply "brightening up" or "lowering contrast" linearly, a tone curve is a graph that reflects the value of each colour after a filter.  

For example, a filter may bet that originally dark pixels become much lighter, but those that were already bright hardly change at all, thus achieving more contrast. A LUT works like a table thattakes an input colour and converts it to an output colour. That is, the filter consults that table to "know" that, for example, a specific blue should become a greenish blue, or that a slightly pale skin tone should be transformed into a more tanned one. In this way, this colour mapping processassigns a new value to each pixel according to predefined rules, achieving effects such as dramatic contrasts, vintage colours or dreamy atmospheres consistently throughout the photo.

In short, altering pixels with mathematical functions means thatevery number in the image is modified according to a formula. This can be adding a fixed amount, multiplying by a percentage, applying a curved function (e.g. raising to a power to enhance halftones), or using reference tables filled with pre-calculated numbers.

The important thing is that behind every "brightness", "contrast" or "saturation" slider we use in the app, there are mathematical operations. Instagram's filters apply hundreds of these operations in milliseconds to each photo, adjusting each pixel to get the desired look.

But filters don't just change colours; many also add fun effects to a face: puppy dog ears and nose, flower crowns, virtual make-up, etc. For that effect to be placed in the right place, the software must firstrecognise a facein the image.

That is, it needs to detect where the face is and understand certain features of it. How does a mobile phone achieve something like this? The answer lies incomputer vision, an area of artificial intelligence that teaches machines to "see" images. How computer vision algorithms work, and the role they play in apps like Instagram, will be discussed in the next article.

Read more about

TikTok, Artificial Intelligence and mathematical probability

5 reasons why you should study mathematics applied to software engineering.

The perfect tandem for your future: mathematics and software engineering.

Related Insights

Ciencia y Tecnología

Automating SECPHO's strategic communication with Artificial Intelligence

16 November 2025

Isabel González is an alumni of the Master in Artificial Intelligence at UDIT, a programme she studied after completing her studies in Computer Engineering at the University of León and an Erasmus stay at the University of Pardubice (Czech Republic). It was during this academic stage when she began to develop a marked interest in data analysis and the application of artificial intelligence to process improvement


Un joven sonriente se encuentra de pie en una sala de reuniones con paneles de vidrio.
Ciencia y Tecnología

UDIT alumnus develops AI tool to boost business cooperation

6 October 2025

One of the great challenges in today's technological ecosystems is to identify opportunities for collaboration between agents with different profiles. This need was the starting point for the Master's thesis of Yannick José Medina, a student of the Master's in Artificial Intelligence at UDIT, who developed an innovative solution for Secpho, a cluster of companies specialising in DeepTech. His proposal: a conversational recommendation system based on artificial intelligence that facilitates and speeds up the connection between partners.

Una mujer sonriente con una blusa blanca y una falda negra con motivos, posa en un ambiente moderno de oficina.
Ciencia y Tecnología

Bills under control: UDIT alumni applying AI to save time and cut costs

29 September 2025

Belén Gómez is an alumniof the Master in Intelligence at UDIT. A firm advocate ofthe strong potential that this technology has to add value in different business areas, her TFM ("Extraction of invoice information with artificial intelligence") , carried out in collaboration with Tendamproposes a proof of concept to automate the extraction of invoice information using advanced AI tools.