Previous Up Next

28.1.2  Creating and loading images

The image command creates image objects from files or data.

Examples

img:=image("/usr/local/share/giac/doc/logo.png")
     
an image of size 64×64 (RGBA)           

The command lines below create a simple noisy grayscale image with n× n pixels.

n:=200:; p:=(j,k)->round(max(0,min(255,1000*((j-n/2)^2+(k-n/2)^2)/n^2+randnorm(0,10)))):; data:=matrix(n,n,p):; img:=image(1,data)
     
an image of size 200×200 (grayscale)           
display(inv(img))

We are displaying the negative image (inv is applied) to have an impression of a square-shaped picture.


Previous Up Next