algorithmimage-processingcomputer-visioninstagramlightroom

How can I implement an Instagram photo filter?


I've been wondering, what theory and algorithms are behind Instagram(and any other) photo filters, Lightroom presets, etc?

How does one create new filters? Manually tweaking Hue, Saturation and Brightness until an image looks nice?
How can I implement one in Python/Java?

What keywords should I search for to get some understanding in this area?


Solution

  • You can use Python library pilgram like in this example. It provides instagram filters and different blending modes (_1977, aden, brannan, brooklyn, clarendon, earlybird, gingham, hudson, inkwell, kelvin, lark, lofi, maven, mayfair, moon, nashville, perpetua, reyes, rise, slumber, stinson, toaster, valencia, walden, willow, xpro2).

    from PIL import Image
    import pilgram
    
    im = Image.open('sample.jpg')
    pilgram.aden(im).save('sample-aden.jpg')
    

    There is also implementation of some filters and Gotham filter, but pilgram is better.