03/20/2005
Stulric,
I just completed a program in Power Basic to create .ico files from 32 x 32 pixel (16 color palette) .bmp files. Accordingly, if you can convert your .gif file to .bmp and then reduce it to 32 x 32 pixels and reload and resave it under 16 colors (4 bits) this program may be just the thing for you.
The program follows. Note that my editor depends upon 80 character lines. You may have to edit the following, especially the DATA, comment, and PRINT lines to combine two lines into one so that the carriage return or other delimiters are properly observed. The DATA lines are generally broken into 16 data items per line, 4 groups of four each. I have checked and tested the results of this program only briefly, but it seems to produce a working .ico file. "Leaky Roof"
cls
PRINT "This program will produce an .ico file from a .bmp file that is"
PRINT "itself created as a 32 x 32 pixel image using only a 16 color"
PRINT "palette."
ErrorLoop:
PRINT
PRINT "Name you want to give to .ico file that will be produced "
PRINT "(use only 8 characters)"
PRINT "(note that A:\ will be automatically prepended and .ICO will be"
PRINT "automatically appended.):"
INPUT Filename1$
IF Len(Filename1$) < 9 Then GOTO Continue1 Else GoTo ErrorLoop1
ErrorLoop1:
Beep: Print "TOO LONG OF NAME!"
GoTo ErrorLoop
Continue1:
Filename1$ = "A:" + Filename1$ + ".ICO"
ErrorLoop3:
PRINT
PRINT "Now type the name of the .bmp file to be inserted into this new"
PRINT ".ico file (8 characters or less, and note that A:\ will"
PRINT "automatically be prepended and .BMP will automatically be"
PRINT "appended):"
INPUT Filename2$
If Len(Filename2$) < 9 Then GOTO Continue2 Else Goto ErrorLoop4
ErrorLoop4:
Beep: Print "TOO LONG OF NAME!"
GoTo ErrorLoop3
Continue2:
Filename2$ = "A:" + Filename2$ + ".BMP"
'Following are the first 126 bytes to go into typical .ico file created
'by Visual Basic 1.0.
DATA 000,000,001,000, 001,000,032,032, 016,000,000,000, 000,000,232,002
DATA 000,000,022,000, 000,000,040,000, 000,000,032,000, 000,000,064,000
DATA 000,000,001,000, 004,000,000,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 000,000,016,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 128,000,000,128, 000,000,000,128, 128,000,128,000
DATA 000,000,128,000, 128,000,128,128, 000,000,192,192, 192,000,128,128
DATA 128,000,000,000, 255,000,000,255, 000,000,000,255, 255,000,255,000
DATA 000,000,255,000, 255,000,255,255, 000,000,255,255, 255,000
'Following are the last 128 bytes to go into typical .ico file created
'by Visual Basic 1.0.
DATA 000,000,000,000, 000,000,000,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 000,000,000,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 000,000,000,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 000,000,000,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 000,000,000,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 000,000,000,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 000,000,000,000, 000,000,000,000, 000,000,000,000
DATA 000,000,000,000, 000,000,000,000, 000,000,000,000, 000,000,000,000
print "Putting first 126 bytes into the new .ico file (header) called"
print Filename1$
open Filename1$ as #1 Len=1: 'The new .ico file
Field #1, 1 as A$
CountForFile1 = 0
For X = 1 to 126
READ AA
Lset A$=Chr$(AA)
CountForFile1 = CountForFile1 + 1
Put #1, CountForFile1
Next X
Print "Now adding bitmap data from known .BMP file to the new .ICO file."
Open Filename2$ AS #2 Len=1: 'The .bmp file.
Field #2, 1 As B$
For X=119 To 630
Get #2, X
Lset A$=B$
CountForFile1 = CountForFile1 + 1
Put #1, CountForFile1
Next X
Close #2
Print
Print "Now adding footer to new .ico file."
For X=1 to 128
Read AA
CountForFile1 = CountForFile1 + 1
Lset A$=Chr$(AA)
Put #1, CountForFile1
Next X
Close #1
Print
print "Done."
End
|