// I need to

ModernizeUpgrade without breaking it RescueFix what someone else started Build NewTurn an idea into a product Reach More PeopleGet found, get used, include everyone

// Company

Case StudiesExpertiseAbout + CareersResourcesContact Book a call →

Instagram Photo Styles with CSS

Recreate Instagram-style retro photo filters with CSS FilterEffects and image overlays: grayscale, sepia, brightness, contrast, and more, with code.

Daisey Traynham Apr 19, 20132 min read

From the Art+Logic archive · written in 2013. The tools may have moved on; the thinking still holds.

Instagram Photo Styles with CSS

Those cool retro filters aren’t just for cameras and image editors anymore…

By coupling FilterEffects and a few simple image overlays, we’re able to achieve some pretty cool effects similar to those produced by camera apps, such as Instagram. Be warned, these filters are only supported by webkit browsers at this point, but it’s still an exciting glimpse into the future of CSS and a fun way to explore photo manipulation via code.

The Basic Styles

the original image

FilterEffects allows you to apply several effects, such as grayscale, sepia, brightness, contrast, invert, saturation, hue-rotation, etc - but for this post, let’s just pick a few to show the basic idea.

My sweet and amazing Quasi Kitty will be modeling these effects for us today.

Grayscale

.grayscale {-webkit-filter: grayscale(100%);}

The default value is 0%. This saturation can be adjusted ranging from 0% (original full color) to 100% (complete grayscale) The in-between values have some nice effects too.

Sepia

.sepia {-webkit-filter: sepia(100%);}

The default value is 0%, which applies zero sepia. Full sepia value is 100%. You can also use mid-range values.

Brightness

CSS Brightness
.brightness {-webkit-filter: brightness(20%);}

The default brightness is 0%. Values above 0 brighten the image, while negative values darken the image.

Contrast

.contrast {-webkit-filter: contrast(150%);}

This default contrast value is 100%, which is the original image. Increasing the value increases the contrast, while decreasing the value lessens the contrast.

Cool, right?

Now, here’s where it really gets fun ;)

You can experiment with overlaying textures, lens flares, gradients, etc and applying these same basic filters to those overlays. Here’s a  lens flare image which will we’ll drop on top of the original image, with a 50% transparency.

.flare {
     opacity:.5;
     filter:alpha(opacity=50);
 }

If you throw both images (original and the overlay) in their own divs, you can layer them by z-indexing and absolute positioning.

<div>
   <div class="photo">
      <img src="quasi.png">
   </div>
   <div class="overlay">
      <img src="flare.png" class="flare">
   </div>
</div>

The CSS.

.photo {z-index: 1; position: absolute; }
.overlay {z-index: 2; position: absolute;}

Here’s an example of mixing the basic styles with a transparent overlay.

And why stop there?

Quasi Kitty - the rainbow remix

You can layer as many divs as you want to really achieve that old, vintage, color blasted, lens flared Instagram flavor. Also, try applying the basic styles to the overlays, such as contrast, brightness, etc.

FilterEffects also provides blur, saturate and hue-rotate, which may not be fully supported yet, but again, fun to play with.

Say cheese!  snap

keep going

More to explore in Reach More People.

All Reach More People resources →
let's talk

Got a problem like this one?

Tell us what's stuck. A real person replies within one business day.

Talk to our team →

Talk to people who know software, not a sales script.

Your first call is with Aja, our VP of Sales. He'll help make sure you're solving the right problem. Here's what you'll cover together:

  1. What you're trying to accomplish

    The business goal first, then the technology.

  2. Possible approaches

    And the tradeoffs of each, in plain language.

  3. Risks you may not have considered

    Technical and business, before they cost you.

  4. Whether AI changes the math

    What's practical, and what's just hype for your project.

  5. Sensible next steps

    Even if the right next step is not us.

book-a-call.ics

Loading the scheduler…

Open the booking page →

Some problems are easier to explain in writing. Send us a few lines about what you're working on, and we'll reply within one business day. Helpful to include:

  1. What the software does, or should do
  2. What's stuck, or what's worrying you
  3. Any deadline or budget you have in mind
note.md

Loading the form…