imageMath.frink

Download or view imageMath.frink in plain text format


/** This demonstrates adding, multiplying, and otherwise modifying a color
    image using operations on each color channel. */


i1 = new image["file:trs80iiib.jpg"]
i2 = new image["file:circleTransNormal.png"]

c1 = i1.toColorChannels[]
c2 = i2.toColorChannels[]

c3 = new array
for c = 0 to 2
   c3.push[(c2@c).multiplyInPlace[c1@c]]

// Push alpha channel unmodified
//c3.push[c2@3]

i3 = new image[toArray[first[c3,3]], true]
//i3 = new image[c3, true]  // Use alpha channel
i3.show[]
i3.write["imageMath.png"]


Download or view imageMath.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20145 days, 7 hours, 2 minutes ago.