1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
############################################################################
#
# File: gif2blp.icn
#
# Subject: Program to convert B&W GIF to a BLP
#
# Author: Ralph E. Griswold
#
# Date: March 4, 2003
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# AD HOC. Assumes any non-black pixel is white.
#
############################################################################
#
# Requires: Version 9 graphics
#
############################################################################
#
# Links: patxform, wopen
#
############################################################################
link patxform
link wopen
procedure main(args)
local width, height, row, p, y, rows
WOpen("image=" || args[1], "canvas=hidden") |
stop("*** cannot open image")
width := WAttrib("width")
height := WAttrib("height")
rows := []
every y := 0 to height - 1 do {
row := ""
every p := Pixel(0, y, width, 1) do
if ColorValue(p) == "0,0,0" then row ||:= "1"
else row ||:= "0"
put(rows, row)
}
write(rows2pat(rows))
end
|