home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
DOS
/
GRAFISCH
/
GIFCM133
/
GC133.DOC
< prev
next >
Wrap
Text File
|
1994-11-16
|
23KB
|
516 lines
The GIF COMMENTOR v1.33
INTRO
As with many other utilities, this one was written because its
author could not find an existing one which would do what was
required: embed textual comments into GIF files. Most of the
more popular GIF viewers have a facility for viewing embedded
comments. A picture may be worth a thousand words, but often
some explanatory text is also very helpful. Many GIF files of a
technical nature have lengthy embedded comments, but if for some
reason one has to edit the graphic part of the file, say by
cropping, then save the resultant GIF, the comment part is
missing from the new GIF (and often replaced by an advertisement
for the cropping program!) GIF Commentor enables the comment to
be easily reembedded. It can also be useful to embed the
original GIF filename in the GIF particularly if it is abstract
(eg. PB1147-A.GIF) and one wishes to rename it to something
more descriptive, or if the original GIF filename is longer than
DOS allows (eg. EARTH_BY_NIGHT.GIF - many GIF sources are Unix
based).
WHAT'S NEW from v1.2
1. Scanning of the current directory and reporting the number of
existing comments in any GIF files found.
2. Viewing of embedded comments: last comment, a specified
comment or all comments. An in-built scrolling text viewer with
Find and Repeat find features facilitates comment viewing (see
below for details). This saves having to view the GIF if you
merely want to read its comments; also most GIF viewers provide
only static comment display.
3. Removal of any comment by erasure (overwriting the text with
spaces) where removing it by truncating the GIF file might
damage what remains.
Changes in Existing Features from v1.2
The previous Remove, No prompt (/rn) mode has been renamed to
Remove, without (eX) prompting (/rx) mode to avoid confusion
with Remove nth comment (/r[n]). Also, previously the Remove
last comment operation aborted if the last comment was unsafe to
remove by truncating the GIF file. Now under equivalent circum-
stances, the operation would proceed and the comment would be
removed by erasure (overwriting the text with spaces).
Features of The Scrolling Text Viewer
1. The viewer is designed to work with a screen which is 80
columns wide. A variable number of screen lines is accommodated
however (the usual number of screen lines is 25).
2. The viewer activates automatically if the total number of
display lines (including titles which GIF Commentor adds) of the
comment or comments requested for viewing is more than about
half a screenful.
3. A bottom status line indicates line numbers displayed, keys
to move through the display and keys to activate the Find text
and Repeat find features, and Quit .
4. Trailing blank lines in comments are not displayed, though a
single blank line after the final displayed comment is added for
appearance sake, if the display exceeds a screenful.
5. The Find text feature does a simple case-insensitive search
for the text entered, beginning at the top of the current screen
and proceeding through to the document's end.
6. The Repeat find feature searches from the last Find text
instance found through to the document's end. If Repeat find
is activated when no Find text has been specified, the Find
text dialogue box is displayed.
7. The scrolling text viewer's capacity is limited but its 700
line maximum should be enough to accommodate even the most
verbosely commented GIF file. A banner line announces if the
viewer capacity has been reached.
8. Pressing q or the Esc key exits the viewer.
WHAT IT DOES
GIF Commentor's major functions may be summarised:
* Scans a specified GIF file and reports the number of existing
comments. Scans the current directory and reports the number
of existing comments in all GIF files found.
* Embeds specified text at the end of a GIF file, with or
without leading and/or trailing carriage-returns/line-feeds.
Embedded text becomes an integral part of the GIF file
according to the CompuServe GIF89a specification.
* Enables viewing of the last comment, a specified comment or
all comments.
* Enables extraction of the last or a specified comment to a
series of text files.
* Enables removal (if safe) of the last comment in a GIF file by
truncation, or removal by erasure of any comment otherwise.
* Enables making of a series of backups of a GIF file.
These and other associated utility functions also available, are
described fully in the following sections.
HOW TO USE
Run GC.EXE without any command line parameters to see the Usage
screen.
Run gc [GIF name] without any other parameters to see if the
specified GIF file contains existing embedded comments. The
maximum number of comments handled is nine.
Note that multiple command line parameters when used may occur
in any order on the command line.
TO EMBED A COMMENT, there must be at least two command line
parameters present, one (and one only) GIF filename or name (eg.
test.gif or test) and EITHER one (and one only) text filename or
name (eg. abc.txt or abc) OR text in double quotes (eg. "Jupiter
and moons"). Maximum ["text"] allowable will vary according to
the length of what else is on the command line, but a full line
of text (80 characters) should usually be possible (on the
command line, ["text"] would need to wrap to the next line to
achieve a full line of text).
eg. At a DOS prompt (eg. C:\GIF>, where C:\GIF contains the
relevant files), type:
gc test abc (and press Enter)
gc test abc.txt (and press Enter)
gc test.gif "NGC2001 via "fixed" H.S.T." (and press Enter)
gc test "Artist's impression of major asteroid impacting Earth's
northern hemisphere (meteor.gif from JPL)" (and press Enter)
Note that if more than 2 sets of quote marks (") occur in text
on the command line, everything between the first and last set
will be taken as ["text"].
If just the name of a text file is given (eg. abc), GIF
Commentor will attempt to open the file ABC. (ie. no extension);
if this fails, it will attempt to open ABC.TXT. If that also
fails, all execution will halt with a PROBLEM message. In this
case, the complete filename of the text file must be specified:
eg. To embed XYZ.DOC in TEST.GIF, type:
gc test xyz.doc (and press Enter)
Pathnames may also be used if desired.
eg. While in C:\, one could type:
gc c:\gif\test d:\docs\abc (and press Enter)
COMMAND LINE SWITCHES
A series of operations specified through the use of a mixture of
switches will occur in the following order, regardless of how
the switches are arranged on the command line:
1. Backup the specified GIF file
2a. View the last comment, a specified comment or all comments
2b. Extract the last or a specified comment to a text file
3. Remove the last or a specified comment
4. Cleanup the specified GIF file
5. Set GIF type
6. Embed text as a comment
Operations on the last comment take precedence over operations
on other comments, except in the case where a request for the
last comment to be removed has been given (/r or /rx), in
which case all operations on the last comment will occur after
those on specified comments. Because of this, the order in which
View and Extract operations will occur will vary and in the
listing above they are given equivalent rank.
The Last Comment is defined as being the comment nearest the GIF
file's end. Note that the Last Comment may always be operated
on, even if the GIF file contains more than nine comments. Where
a GIF file contains several comments, Comment #1 is closest to
the beginning of the file.
If a View, Extract or Remove operation is specified on a comment
whose number exceeds the actual number of comments present, when
that request is reached all operation will halt with a PROBLEM
message.
The number of valid combinations of switches is large (though
the number one would WANT to use is limited) and so hopefully
this order preempts what might be requested. It's obviously good
sense to make the Backup first, and it would make no sense to
embed a comment only to remove it immediately. It might make
sense to remove an existing comment and replace it with a new
one however. If all else fails, operations can always be done
one at a time.
/a - scan All GIF files in the current or a specified directory
and report the number of existing comments in each. Note that
this may NOT be done in conjunction with any other operation.
/b - make a Backup. The original GIF (eg. test.gif) is renamed
to TEST.BK[n] (n = 1 through 9, according to which files already
exist). TEST.BK[n] is copied to TEST.GIF using the internal DOS
copy command, with the verify switch.
If all 9 backups already exist, all execution will halt and a
PROBLEM message will suggest that you delete at least one backup
file. NO BACKUP is the default so, as common sense suggests,
you should keep original copies of valuable GIFs elsewhere.
eg. To make a backup of TEST.GIF, type:
gc test /b (and press Enter)
/c - Cleanup the specified GIF file by removing extraneous 00h
bytes or end-of-file (EOF) markers (1Ah) which occur after the
GIF terminator (3Bh). Note that "Cleanup" automatically occurs
before embedding of a comment, so that while the switch may also
be specified then it is ignored as a separate process.
GIF files obtained by downloading from BBSs or networks such as
InterNet sometimes contain such superfluous bytes.
eg. To cleanup TEST.GIF, type:
gc test /c (and press Enter)
/e- - prevents any carriage-return/line-feeds (CR-LFs) or
end-of-file (EOF) markers (1Ah) already present at the very End
of the specified text from being included in the embedded
comment. Many editors such as MS-DOS's EDIT add invisible CR-LF
bytes (0Dh 0Ah) to the end of any text file they generate. This
switch is automatically in effect if /e[n] (see following) is
specified, to ensure the desired number of CR-LFs at the end of
a comment.
eg. To ensure no CR-LFs or EOF markers at the end of embedded
text, type:
gc test /e- (and press Enter)
/m - Marks the comment position in bytes when viewing a comment
by displaying it in brackets (eg. (@123678) ) in the comment
announcer. This can be useful when tracking down apparent
comment anomalies.
eg. to mark the position of the last comment in TEST.GIF, type:
gc test /v/m (and press Enter)
/s[n] - add [n] (n = 1 through 9) carriage-returns/line-feeds
(CR-LFs) at the Start of the specified text. /s acts the same
as /s1 .
This is useful if you want to add another comment to a GIF which
already contains a comment, so that the comments are properly
separated. Note that some GIF viewers automatically display
distinct comments separately regardless of CR-LFs, some do not
(GIF Commentor automatically display comments separately). Only
one instance of /s[n] may be specified on any one occasion.
/e[n] - add [n] (n = 1 through 9) carriage-returns/line-feeds
(CR-LFs) at the End of the specified text. /e acts the same as
/e1 . Only one instance of /e[n] may be specified on any one
occasion.
eg. To place two CR-LFs at both the start and the end of text
(as ABC.TXT) to be embedded in TEST.GIF, type:
gc test abc /s2/e2 (and press Enter)
/r - Remove the last comment in the GIF file if the option to
proceed is chosen and if it is "safe" to do so ie. if the
comment is separated from the GIF terminator (3Bh) by 00h bytes
only. If this is not the case, the last comment will be erased
instead ie. the text of the comment is overwritten with spaces.
The reason for such caution is that when comments are removed,
the file is TRUNCATED from the beginning of the comment block
onwards. Removing a comment at the very end of the GIF file will
do no harm to the graphic part (though the converse will also
almost always apply).
Up to 255 characters of the comment found are displayed,
execution pauses and the options to proceed with removal or to
abort are given.
The reason for providing an option which displays at least the
beginning of the comment is that comments can occur anywhere in
the GIF file between control and data blocks, but it is beyond
the scope of GIF Commentor to identify such blocks. So in
identifying a comment, it looks for the byte sequence 21h FEh,
then proceeds to check the comment for internal consistency,
according to the GIF89a specification. It's possible though
uncommon, for a non-comment series of bytes (which will display
as a meaningless sequence of symbols) to be identified as a
comment.
eg. To remove the last comment, then add a new comment
immediately afterwards, type:
gc test /r "archie.au: /images/earth7.gif"
(and press Enter, then y )
Note that if abort is chosen, all execution halts and the new
comment is not embedded.
/r[n] - Remove the nth comment in a GIF file, where n is 1
through 9 and is the number of the comment, if the option to
proceed is chosen. If the nth comment happens to be the last
comment, it will be removed by truncating the GIF file if "safe"
to do so, or by erasure otherwise (see notes for /r above),
again only if the option to proceed is chosen. Comments which
are not the last comment will be removed by erasure.
Note that /r1 is NOT the same as /r unless there is only one
comment present. Only one instance of /r[n] may be specified
on any one occasion.
/rx - Remove the last comment in the GIF file by TRUNCATION
without (eX) prompting, if it is "safe" to do so (notes as for
/r apply). NO option to abort is given and GIF Commentor
removes what it identifies as the last comment in the GIF file.
This is useful when you want to quickly remove a known comment
at the end of a GIF file. See also notes as for /r above.
eg. To remove all bytes in TEST.GIF beyond and including the
last comment, type:
gc test /rx (and press Enter)
/v - View the last comment. If the total number of display lines
(including titles which GIF Commentor adds) is about half a
screenful, a static display is given (note that trailing blank
lines are not displayed), otherwise the scrolling text viewer
activates (see WHATS NEW section for a description of features).
Normally carriage-returns and line-feeds occurs as CR-LF pairs,
so GIF Commentor interprets a line-feed (LF or 0Ah) unpaired
with a carriage-return (CR or 0Dh), or a CR unpaired with a LF,
as a CR-LF pair, to obviate overwriting of an existing line with
a subsequent one or improperly formatted text. Should a
preexisting comment still display in a garbled but
semi-intelligible fashion, an exact (byte for byte) copy of the
comment may be obtained using the extract switch (see /x or
/x[n]). It should be possible to remove (see /r /rx or /r[n]),
reformat (using a suitable text or binary editor) and reembed
that particular comment.
eg. To view the last comment in TEST.GIF, type:
gc test /v (and press Enter)
/v[n] - View the nth comment, where n is 1 through 9 and is the
number of the comment. Notes as for /v apply.
Note that /v1 is NOT the same as /v unless there is only one
comment present. Only one instance of /v[n] may be specified
on any one occasion.
eg. To view the 2nd comment in TEST.GIF, type:
gc test /v2 (and press Enter)
/va - View All comments (up to a maximum of nine comments).
Notes as for /v apply.
eg. To view all comments in TEST.GIF, type:
gc test /va (and press Enter)
/x - eXtract the last comment in the GIF file to a text file
with filename X[m].TXT (where is m is 1 through 9, according to
which backup files already exist). This feature can be useful if
you want a text file/hardcopy of an existing comment or wish to
modify an existing comment.
/x[n] - eXtract the nth comment in the GIF file to a text file
with filename X[m]#n.TXT, where m is as before, and n is 1
through 9 and is the number of the comment, comment #1 being
closest to the front of the file. Thus X3#2.TXT is the 3rd
backup of comment #2. If however, there are say only 3 comments
present, the 3rd comment will be recognized as the last comment
and /x3 will extract the 3rd comment to X[m].TXT.
Note that /x1 is NOT the same as /x unless there is only one
comment present. Only one instance of /x[n] may be specified
on any one occasion.
eg. To extract the last comment in TEST.GIF to a file, type:
gc test /x (and press Enter)
If all of X1.TXT through X9.TXT already exist, all execution will
halt and a PROBLEM message will suggest that you delete at least
one extraction file.
eg. To extract the 2nd comment in TEST.GIF to a file, type:
gc test /x2 (and press Enter).
Similarly, if all of X1#2 through X9#2 exist, all execution will
halt with a PROBLEM message.
/t± - embed the comment one byte after (/t+) or one byte before
(/t-) the GIF Terminator. Usually a GIF terminates with the
byte sequence 00h 3Bh. GIF Commentor normally embeds the
comment starting at 3Bh by changing it to 21h, the comment
identifier. However experience shows that some GIF viewers are
sensitive to where comments start and in this case won't display
the comment. Starting the comment one byte position after or
before 3Bh often solves this problem.
eg. To use this feature when embedding a comment, type:
gc test /t+ "Sunset on Mars" (and press Enter)
OR
gc test /t- "Sunset on Mars" (and press Enter)
/87 - set the GIF type to GIF87a. Useful if you need to change
the type to this.
One very good use of this is if you want to use Rob van
Helmond's excellent utility GIFPALET.EXE (part of 6GIFUTL2.ZIP,
shareware), which changes a GIF's background colour. GIFPALET
works on GIF87a but not on GIF89a files, though seems to work OK
on the latter if the identifier bytes in the GIF header are
changed to GIF87a (which is what /87 does). If the specified
GIF contains any comments, be sure to restore the GIF type to
GIF89a so that GIF viewers will still display its comments.
Note that as officially only the GIF89a type supports comments,
GIF Commentor won't allow this switch to be used with a text
name/filename, ["text"], /e-, /s[n], /e[n], /v, /v[n], /va, /x,
/x[n], /t± or /89 ie. anything to do with embedding, viewing or
extracting a comment. GIF Commentor will however, view comments
in GIF files of either GIF87a or GIF89a type.
eg. typing:
gc test /b/87/ru (and press Enter), will execute
gc test /87 descript.doc (and press Enter), will abort
/89 - set the GIF type to GIF89a. Useful if you need to change
the type to this. See notes for /87 .
Note that the GIF type is automatically set to GIF89a during
embedding of a comment, so while the switch may be specified
then, it is ignored as a separate process.
eg. To set the GIF type to GIF89a, type:
gc test /89 (and press Enter)
DOGMA
This program is distributed as Shareware. While all due care has
been taken in the construction of this program, if you choose to
use it, you do so entirely at your own risk and NO liability
will be accepted by the author for consequent loss or damage of
any kind.
Individuals may use GIF Commentor for their own private (non-
commercial) purposes gratis ie. for no charge. However, if you
use the program, please send an E-mail message with constructive
comments to:
psjrl@wombat.newcastle.edu.au (InterNet)
Businesses or anyone anticipating any commercial use of GIF
Commentor MUST obtain prior written permission by contacting:
SoftView, P.O. Box 35, Cooranbong 2265, N.S.W., Australia.