utility - ImageMagick Utility Routines
AppendImageFormat(format,filename)
ClientName(filename)
ExpandFilename(filename)
ExpandFilenames(argc,argv)
GlobExpression(expression,pattern)
status=IsAccessible(filename)
status=IsDirectory(filename)
value=LSBFirstReadLong(file)
value=LSBFirstReadShort(file)
LSBFirstWriteLong(value,file)
LSBFirstWriteShort(value,file)
filelist=ListColors(pattern,number_colors)
filelist=ListFiles(directory,pattern,number_entries)
LocaleFilename(filename)
MSBFirstOrderLong(p,length);
value=MSBFirstReadLong(file)
value=MSBFirstReadShort(file)
MSBFirstWriteLong(value,file)
MSBFirstWriteShort(value,file)
geometry=PostscriptGeometry(page)
status=ReadData(data,size,number_items,file)
list=StringToList(text)
Strip(data)
TemporaryFilename(filename)
Function AppendImageFormat appends the image format type to the filename.
If an extension to the file already exists, it is first removed.
The format of the AppendImageFormat routine is:
AppendImageFormat(format,filename)
A description of each parameter follows.
- o format:
-
Specifies a pointer to an array of characters. This is the format of the
image.
- o filename:
-
Specifies a pointer to an array of characters. The unique file name is
returned in this array.
Function ClientName removes the path name component and any extensions.
The format of the ClientName function is:
ClientName(filename)
A description of each parameter follows:
- o filename:
-
Specifies a pointer to an character array that contains the filename.
Function ExpandFilename expands '~' in a filename.
The format of the ExpandFilename function is:
ExpandFilename(filename)
A description of each parameter follows:
- o filename:
-
Specifies a pointer to an character array that contains the filename.
Function ExpandFilenames checks each argument of the command line vector
and expands it if they have a wildcard character. For example, *.jpg might
expand to: bird.jpg rose.jpg tiki.jpg.
The format of the ExpandFilenames function is:
ExpandFilenames(argc,argv)
A description of each parameter follows:
- o argc:
-
Specifies a pointer to an integer describing the number of elements in the
argument vector.
- o argv:
-
Specifies a pointer to a text array containing the command line arguments.
Function GlobExpression returns True if the expression matches the pattern.
The format of the GlobExpression function is:
GlobExpression(expression,pattern)
A description of each parameter follows:
- o expression:
-
Specifies a pointer to a text string containing a file name.
- o pattern:
-
Specifies a pointer to a text string containing a pattern.
Function IsAccessible returns True if the file as defined by filename is
accessible.
The format of the IsAccessible routine is:
status=IsAccessible(filename)
A description of each parameter follows.
- o status:
-
Function IsAccessible returns True is the file as defined by filename is
accessible, otherwise False is returned.
- o filename:
-
Specifies a pointer to an array of characters. The unique file name is
returned in this array.
Function IsDirectory returns True if the file as defined by filename is a
directory. Once MetroWerks write a stat(2)
function, we can
remove the chdir(2)
function.
The format of the IsAccessible routine is:
status=IsDirectory(filename)
A description of each parameter follows.
- o status:
-
Function IsDirectory returns True is the file as defined by filename is a
directory, otherwise False is returned.
- o filename:
-
Specifies a pointer to an array of characters. The unique file name is
returned in this array.
Function ListColors reads the X client color database and returns a list of
colors contained in the database sorted in ascending alphabetic order.
The format of the ListColors function is:
filelist=ListColors(pattern,number_colors)
A description of each parameter follows:
- o filelist:
-
Function ListColors returns a list of colors contained in the database. If
the database cannot be read, a NULL list is returned.
- o pattern:
-
Specifies a pointer to a text string containing a pattern.
- o number_colors:
-
This integer returns the number of colors in the list.
Function ListFiles reads the directory specified and returns a list of
filenames contained in the directory sorted in ascending alphabetic order.
The format of the ListFiles function is:
filelist=ListFiles(directory,pattern,number_entries)
A description of each parameter follows:
- o filelist:
-
Function ListFiles returns a list of filenames contained in the directory.
If the directory specified cannot be read or it is a file a NULL list is
returned.
- o directory:
-
Specifies a pointer to a text string containing a directory name.
- o pattern:
-
Specifies a pointer to a text string containing a pattern.
- o number_entries:
-
This integer returns the number of filenames in the list.
Function LocaleFilename replaces the contents of the string pointed to by
filename by a unique file name relative to the directory.
The format of the LocaleFilename routine is:
LocaleFilename(filename)
A description of each parameter follows.
- o filename:
-
Specifies a pointer to an array of characters. The unique file name is
returned in this array.
Function LSBFirstReadLong reads a long value as a 32 bit quantity in
least-significant byte first order.
The format of the LSBFirstReadLong routine is:
value=LSBFirstReadLong(file)
A description of each parameter follows.
- o value:
-
Function LSBFirstReadLong returns an unsigned long read from the file.
- o file:
-
Specifies the file to read the data from.
Function LSBFirstReadShort reads a short value as a 16 bit quantity in
least-significant byte first order.
The format of the LSBFirstReadShort routine is:
value=LSBFirstReadShort(file)
A description of each parameter follows.
- o value:
-
Function LSBFirstReadShort returns an unsigned short read from the file.
- o file:
-
Specifies the file to read the data from.
Function LSBFirstWriteLong writes a long value as a 32 bit quantity in
least-significant byte first order.
The format of the LSBFirstWriteLong routine is:
LSBFirstWriteLong(value,file)
A description of each parameter follows.
- o value:
-
Specifies the value to write.
- o file:
-
Specifies the file to write the data to.
Function LSBFirstWriteShort writes a long value as a 16 bit quantity in
least-significant byte first order.
The format of the LSBFirstWriteShort routine is:
LSBFirstWriteShort(value,file)
A description of each parameter follows.
- o value:
-
Specifies the value to write.
- o file:
-
Specifies the file to write the data to.
Function MSBFirstOrderLong converts a least-significant byte first buffer
of integers to most-significant byte first.
The format of the MSBFirstOrderLong routine is:
MSBFirstOrderLong(p,length);
A description of each parameter follows.
- o p:
-
Specifies a pointer to a buffer of integers.
- o length:
-
Specifies the length of the buffer.
Function MSBFirstOrderShort converts a least-significant byte first buffer
of integers to most-significant byte first.
The format of the MSBFirstOrderShort routine is:
MSBFirstOrderLongShort(p,length);
A description of each parameter follows.
- o p:
-
Specifies a pointer to a buffer of integers.
- o length:
-
Specifies the length of the buffer.
Function MSBFirstReadShort reads a short value as a 16 bit quantity in
most-significant byte first order.
The format of the MSBFirstReadShort routine is:
value=MSBFirstReadShort(file)
A description of each parameter follows.
- o value:
-
Function MSBFirstReadShort returns an unsigned short read from the file.
- o file:
-
Specifies the file to read the data from.
Function MSBFirstReadLong reads a long value as a 32 bit quantity in
most-significant byte first order.
The format of the MSBFirstReadLong routine is:
value=MSBFirstReadLong(file)
A description of each parameter follows.
- o value:
-
Function MSBFirstReadLong returns an unsigned long read from the file.
- o file:
-
Specifies the file to read the data from.
Function MSBFirstWriteLong writes a long value as a 32 bit quantity in
most-significant byte first order.
The format of the MSBFirstWriteLong routine is:
MSBFirstWriteLong(value,file)
A description of each parameter follows.
- o value:
-
Specifies the value to write.
- o file:
-
Specifies the file to write the data to.
Function MSBFirstWriteShort writes a long value as a 16 bit quantity in
most-significant byte first order.
The format of the MSBFirstWriteShort routine is:
MSBFirstWriteShort(value,file)
A description of each parameter follows.
- o value:
-
Specifies the value to write.
- o file:
-
Specifies the file to write the data to.
Function MultilineCensus returns the number of lines within a label. A line
is represented by a \n character.
The format of the MultilineCenus routine is:
MultilineCenus(label)
A description of each parameter follows.
- o label:
-
This character string is the label.
Function PostscriptGeometry replaces any page mneumonic with the equivalent
size in picas.
The format of the PostscriptGeometry routine is:
geometry=PostscriptGeometry(page)
A description of each parameter follows.
- o page:
-
Specifies a pointer to an array of characters. The string is either a
Postscript page name (e.g. A4) or a postscript page geometry (e.g.
612x792+36+36).
Function ReadData reads data from the image file and returns it. If it
cannot read the requested number of items, False is returned indicating an
error.
The format of the ReadData routine is:
status=ReadData(data,size,number_items,file)
A description of each parameter follows:
- o status:
-
Function ReadData returns True if all the data requested is obtained
without error, otherwise False.
- o data:
-
Specifies an area to place the information reuested from the file.
- o size:
-
Specifies an integer representing the length of an individual item to be
read from the file.
- o number_items:
-
Specifies an integer representing the number of items to read from the
file.
- o file:
-
Specifies a file to read the data.
Function ReadDataBlock reads data from the image file and returns it. The
amount of data is determined by first reading a count byte. If
ReadDataBlock cannot read the requested number of items, `-1' is returned
indicating an error.
The format of the ReadData routine is:
status=ReadData(data,file)
A description of each parameter follows:
- o status:
-
Function ReadData returns the number of characters read unless there is an
error, otherwise `-1'.
- o data:
-
Specifies an area to place the information reuested from the file.
- o file:
-
Specifies a file to read the data.
Function StringToList converts a text string into a list by segmenting the
text string at each carriage return discovered. The list is converted to
HEX characters if any control characters are discovered within the text
string.
The format of the StringToList routine is:
list=StringToList(text)
A description of each parameter follows:
- o list:
-
Function StringToList returns the string list unless an error occurs,
otherwise NULL.
- o text:
-
Specifies the string to segment into a list.
Function Strip strips the whitespace from the beginning and end of a string
of characters.
The format of the Strip routine is:
Strip(data)
A description of each parameter follows:
- o data:
-
Specifies an array of characters.
Function TemporaryFilename replaces the contents of the string pointed to
by filename by a unique file name.
The format of the TemporaryFilename routine is:
TemporaryFilename(filename)
A description of each parameter follows.
- o filename:
-
Specifies a pointer to an array of characters. The unique file name is
returned in this array.