rewriteImage.frink

Download or view rewriteImage.frink in plain text format


// Sample program to load an image, write semi-transparent "watermark" text
// across it (with a semi-transparent rectangle behind it), and write it
// back out to a file.

g = new graphics

img = new image["https://frinklang.org/images/earthmoon.jpg"]

// Draw the image onto a graphics object at its original size.
g.draw[img, 0, 0, img.getWidth[], img.getHeight[]]

// Draw a watermark right in the center of the picture.
// First a semi-transparent white rectangle
g.color[1,1,1,.3]
g.fillRectCenter[img.getWidth[]/2, img.getHeight[]/2, img.getWidth[], 20]

// And then semi-transparent black text.
g.color[0,0,0,.5]
g.font["SansSerif", 20]
g.text["Frink Rules!", img.getWidth[]/2, img.getHeight[]/2, "center", "center"]

g.show[]
//g.print[]

// Write out to a file at the same size as the original.
g.write["earthmoon1.jpg", img.getWidth[], img.getHeight[], 1]


Download or view rewriteImage.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 19944 days, 22 hours, 35 minutes ago.