/*****
Name: Thuvarrakan Ruban
Date: December 18 2005
Purpose: To convert colour images to black and white!
*****/
proc convert (fname, save : string)
var temp : int := Pic.FileNew (fname)
var res : string := "graphics:" + intstr (Pic.Width (temp)) + ";" + intstr (Pic.Height (temp))
View.Set (res)
Pic.Draw (temp, 0, 0, picCopy)
for x : 0 .. maxcolor /*Sets all the standard colors to shades of black for the purpose of the conversion!*/
RGB.SetColor (x, x / maxcolor, x / maxcolor, x / maxcolor)
end for
for x : 0 .. maxx
for y : 0 .. maxy
drawdot (x, y, whatdotcolor (x, y))
end for
end for
Pic.ScreenSave (0, 0, maxx - 1, maxy - 1, save)
Pic.Free (temp)
end convert
/******************Main Program!!!*******************/
var op : int := Window.Open ("graphics:640;480,nobuttonbar,title:Black and White Conversions") /*Opens Window!*/
var fname, filesavename : string
put "Enter the name of picture file(eg,sample.jpg)"
get fname
put "Enter the name you wish to save it as (eg,thuvs.bmp)"
get filesavename
convert (fname, filesavename) /*Function Call*/
Window.Close (op)
/**************End of Main Program!!!****************/
|