All Projects → peterpeterparker → web-photo-filter

peterpeterparker / web-photo-filter

Licence: MIT license
A Web Component to apply Instagram-like WebGL filters to photos

Programming Languages

HTML
75241 projects
typescript
32286 projects
SCSS
7915 projects

Projects that are alternatives of or similar to web-photo-filter

Atoms
Atoms for Blaze UI
Stars: ✭ 1,505 (+1333.33%)
Mutual labels:  webcomponents, stencil, stenciljs
Stencil
A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
Stars: ✭ 9,880 (+9309.52%)
Mutual labels:  webcomponents, stencil, stenciljs
anywhere-webcomponents
A UI work in progress based on custom elements (web components) for use in anywhere.
Stars: ✭ 17 (-83.81%)
Mutual labels:  webcomponents, stencil, stenciljs
solar-components
Web Components Implementation of Solar Design System
Stars: ✭ 16 (-84.76%)
Mutual labels:  webcomponents, stencil, stenciljs
gatsby-remark-highlight-code
Adds stylish cards and syntax highlighting to code blocks in markdown files
Stars: ✭ 63 (-40%)
Mutual labels:  webcomponents, stencil, stenciljs
Ionic Framework
A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
Stars: ✭ 45,802 (+43520.95%)
Mutual labels:  webcomponents, stencil, stenciljs
block-photos
A photos app built with Ionic and Blockstack as backend.
Stars: ✭ 24 (-77.14%)
Mutual labels:  photos, stencil, stenciljs
mm-components
Music Markups components
Stars: ✭ 50 (-52.38%)
Mutual labels:  webcomponents, stenciljs
stencil-payment
Payment request API implementation in Stenciljs
Stars: ✭ 28 (-73.33%)
Mutual labels:  stencil, stenciljs
domy
Custom Elements Storage
Stars: ✭ 77 (-26.67%)
Mutual labels:  webcomponents, stencil
Awesome Stenciljs
List of Awesome Web Components Built with StencilJS
Stars: ✭ 520 (+395.24%)
Mutual labels:  webcomponents, stencil
Nice Anim
An animate on scroll Web Component built with StencilJS
Stars: ✭ 23 (-78.1%)
Mutual labels:  webcomponents, stencil
Deckdeckgo
The web open source editor for presentations
Stars: ✭ 1,117 (+963.81%)
Mutual labels:  webcomponents, stencil
app-starter
Angular mono-repo (Ionic/Capacitor/StencilJS/Web Component) app starter for supporting cross platform apps.
Stars: ✭ 75 (-28.57%)
Mutual labels:  webcomponents, stenciljs
stenciljs-in-react
Stenciljs components in React: step by step guide
Stars: ✭ 22 (-79.05%)
Mutual labels:  webcomponents, stenciljs
Ionicons
Premium hand-crafted icons built by Ionic, for Ionic apps and web apps everywhere 🌎
Stars: ✭ 15,802 (+14949.52%)
Mutual labels:  webcomponents, stenciljs
pdf-viewer
PDF viewer web component built in StencilJS. Reusable in Angular, Ionic, React, Vue.JS, etc.
Stars: ✭ 65 (-38.1%)
Mutual labels:  stencil, stenciljs
stencil-realworld-app
An example SPA written with Stencil
Stars: ✭ 56 (-46.67%)
Mutual labels:  stencil, stenciljs
ionic-custom-components
🌈 Ionic Tutorial: Mastering Web Components in Ionic Framework. This repo is an Ionic project showcasing Angular custom components and Stencil custom web components.
Stars: ✭ 30 (-71.43%)
Mutual labels:  stencil, stenciljs
stencil-boilerplate
A Stencil app boilerplate including routing, Redux etc.
Stars: ✭ 51 (-51.43%)
Mutual labels:  stencil, stenciljs

Web Photo Filter

Web Photo Filter is a web component to apply Instagram-like WebGL filters to photos.

GitHub release Tweet

Table of contents

Introduction

This component has for goal to make Instagram-like filters for photos accessible for the web.

Image modification solutions and fast processing

Others web based filter solutions often use CSS (for example Instagram.css) or Javascript to modify images.

Applying CSS do not modify the underlying image, and only apply a visual layer to it.

Most Javascript based solutions are not always optimized well enough to be used on mobile devices.

I was looking to create an almost instantaneous filter solution, similar to what Instagram leverages in its mobile application.

Supported by major browsers and devices

As of Feburary 2018, Web Photo Filter utilizes WebGL based technology because it is well supported across modern browsers and mobile devices.

In the future, Web Photo Filter may use WebGL 2 when it will be better supported.

In case WebGL would not be supported on a particular platform, and to avoid producing an error, the component will display the original image without modification.

Lightweight, fast boot time, lazy loading, support across the most popular frontend frameworks

This project is a web component built with the amazing Stencil compiler.

Installation

npm install web-photo-filter

React

You can use a React specific wrapper for this component.

Install it as following:

npm install web-photo-filter-react

Consume it in your code:

import {WebPhotoFilter} from 'web-photo-filter-react/dist';

render() {
    return <WebPhotoFilter/>
}

Usage

The Web Photo Filter Component can be use as following:

<web-photo-filter src="assets/img/test.jpg" filter="sepia"></web-photo-filter>

The only required parameter is the img src tag. It also supports images provided as https if the anonymous crossorigin can be use.

Filter

Filter is an optional parameter. Omitting this attribute or specifying a null value will result in no processing within the component. The source image will be displayed unmodified.

The list of available filters is available in class src/types/web-photo-filter-type.ts. Currently: sepia, blue_monotone, violent_tomato, greyscale, desaturate, brightness, saturation, contrast, hue, cookie, vintage, koda, technicolor, polaroid, bgr.

You can provide a unique filter or, a comma separated list of multiple filters.

filter is a string parameter

Example: Sepia

<web-photo-filter src="assets/img/test.jpg" filter="sepia"></web-photo-filter>

Example: Multiple filters

<web-photo-filter src="assets/img/test.jpg" filter="technicolor, saturation(1.6), contrast"></web-photo-filter>

FilterLoad

If you would like to start or process the result after the component did finish is processing, an event will be triggered containing the resulting image (no filter) or canvas. In addition, it contains also an indication telling you if WebGL is supported or not.

<web-photo-filter onFilterLoad={($event) => imageLoaded($event)} src="imgURI" filter="sepia"></web-photo-filter>

The description of the event is available in the interface src/types/web-photo-filter-result.ts

filterLoad emit an event of type WebPhotoFilterResult

Level

Some filters (brightness, saturation, contrast and hue) are variable. To modify their default values, you could use the variable level.

If multiple filter are provided, it applies to all except if a specific level is provided for a filter, such as for example saturation(1.1).

<web-photo-filter src="assets/img/test.jpg" filter="brightness" level="1.2"></web-photo-filter>

level is a number parameter

Credits

This web component would not had been possible without the brilliant article and WebGL core processing code written by Mike Riethmuller ❤️

The sources of nine filters (Brownie, Brightnes, etc.) were adapted from the project WebGLImageFilter by Dominic Szablewski 👍

Limitation

WebGL is well supported by most modern browsers, but there may be some use cases where it is not. In the case that WebGL is not supported, there is a fallback scenario implemented in the component.

iOS (WKWebView)

While testing a couple of years ago, I found out that Web Photo Filter works very well on iPhone 6 and above. It is possible to load all filters on the same page without performance issues.

Android (WebView)

Likewise I discovered that these filters do not work very well on Android 7 and above. Testing for Android was ran on a Samsung Edge (Android 7.1), Nexus 5X and Sony (Android 8.1).

The Android Webview seems to handle canvas less actively and it's iPhone counterpart. Therefore I do not recommend using all filters on the same page, but only integrating a few of them at a time, otherwise you'll see a negative performance impact.

Tutorial

Simon Grimm (@saimon24) published a tutorial "Ionic Image Filter Like Instagram Using WebGL Filters" which displays step by step how to create a Ionic app and include this component easily.

Note: to follow this tutorial, version 2 of the component has to be use.

License

MIT © David Dal Busco

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].