Processing image-lerping

April 22nd, 2008 · 1 Comment

Often when I base coded graphics on a series of photographies, I manage the change in source-photo (the swapping from one image to another) by making the coded graphics slowly adapt to the changed source. Now, what if I have a project where I can’t depend on the abstracted graphics to do the easing but instead need a soft easing between two images used as a non-rendered source? I need something like the built-in lerpColor() function in Processing but for images! So, I wanted to create a simple class that can handle merging one photo into another but NOT render it to the screen, instead keep it in a PGraphics object to be used as a reference object.

imagelerpexample.jpg

This screenshot shows the sample code in action, to ensure it works the lerped-image is shown onscreen - obviously this is not a real-life situation but useful for debugging.

Download Processing source code here : imageLerpExample.zip

Tags: open source · processing · code driven graphics

1 response so far ↓

  • 1 Mikkel // Apr 28, 2008 at 3:58 pm

    …small footnote, this approach can slow things down quite a bit if you try to lerp large images… improvements to the code are more than welcome.