Skip to content

prontopablo/p5.FIP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

p5.FIP (Fast Image Processing)

Real-time image processing library for p5.js.

日本語チュートリアル。

What is it?

p5.FIP is a library that allows you to add image processing/post-processing effects to your p5.js sketch. In 5 lines of code you can add effects like bloom, glitching, cartoon shading and many more.

Features

  • 44 Effects
  • Hardware Accelerated
  • Documented

Getting Started

To use p5.FIP you can include it in your index.html file:

    <head>
    <!-- ...-->
    <script src="https://prontopablo.github.io/p5.FIP/assets/javascripts/p5.FIP.js"></script>
    <!-- ...-->
    </head>

Alternatively you can download the p5.FIP.js file from releases and bring it into your project files:

    <head>
    <!-- ...-->
    <script src="p5.FIP.js"></script>
    <!-- ...-->
    </head>

The reference website can be found here.

Warning

This library is for p5.js. If you are using Processing instead, head here.

Examples

Example sketches can be found in this collection here and they are also included in the examples folder on GitHub.

Here's an example showing how to apply motion blur to an image:

let ireland, motionBlur;

function setup() {
  createCanvas(600, 600, WEBGL); // Use WEBGL mode to use shaders
  motionBlur = createFilterShader(fip.motionBlur); // Load the motion blur shader
  ireland = loadImage("ireland.jpg");
}
  
function draw() {
  background(255);
  imageMode(CENTER);
  image(ireland, 0, 0, width, height);
    
  // Apply the shader
  filter(motionBlur);
}  

Important

The most recent release of p5.FIP changed how textures work. Now the entire canvas is the default texture. However, if we wanted to only pass a specific texture to our shader, we could use a framebuffer - see the blend example for details.

Repository Structure

  • p5.FIP.js: Shader code itself. This is where the actual functionality of the library is.
  • docs: Reference website code that has been generated using Material for MkDocs from MarkDown files.
  • mdDocs: Markdown files for the reference website. Much more human-readable than the files found in the docs folder, should the reference website no longer be live.
  • examples: Examples showing how to use p5.FIP, just in case the p5.js collection examples no longer work.

p5.js Library Guidelines

In accordance with the p5.js library guidelines:

  1. p5.FIP has no dependencies.
  2. Examples are included.
  3. p5.FIP is open source.
  4. Keywords: image-processing, post-processing, filters.
  5. Last update: 04/02/25.

Contributing

I welcome contributions from the community to make p5.FIP better. If you have any suggestions, bug fixes, or new features to add, feel free to create a pull request.

Acknowledgments

Many of these shaders were adapted from existing solutions in other programming languages, in these cases, the links to the original shaders or tutorials followed can be found at the top of each shader.

A list of existing Processing image processing libraries can be found here.