Name
IsPicture -- determine if a picture is in a supported format
Synopsis
ret, table = IsPicture(file$[, table])
Function
This function will check if the file specified by file$ is in a supported picture format. If it is, this function will return True, otherwise False. If this function returns True, you can load the picture by calling LoadBGPic() or LoadBrush().

New in Hollywood 4.5: This function returns a table now as the second return value. If the specified file is an image, the table will contain some information about the image file. The following fields of the return table will be initialized:

Width:
Contains the width of the image in pixels.

Height:
Contains the height of the image in pixels.

Alpha:
True if image has an alpha channel, False otherwise.

Vector:
True if image is in a scalable vector format, False otherwise. (V5.0)

Transparency:
True if image has a monochrome transparency channel, i.e. a transparent pen in a palette-based image. (V6.0)

Format:
This contains the image format type Hollywood has detected for this file. It can be one of the following special constants:

#IMGFMT_BMP:
BMP image.

#IMGFMT_PNG:
PNG image.

#IMGFMT_JPEG:
JPEG image.

#IMGFMT_ILBM:
IFF ILBM image.

#IMGFMT_GIF:
GIF image.

#IMGFMT_TIFF:
TIFF image.

#IMGFMT_NATIVE:
The image is in a format that can be loaded by the host operating system Hollywood is currently running on. For example, if there is a datatype which can load the image on AmigaOS, you can get #IMGFMT_NATIVE as the result.

#IMGFMT_PLUGIN:
The image is in a format supported by a Hollywood plugin that is installed.

(V8.0)

This function is much faster than LoadBrush() or LoadBGPic() because it will not load the picture. It will just check its format header and return whether or not Hollywood can handle it. However, please note that image plugins you have installed might not be as optimized as Hollywood's inbuilt image loader and so they can slow down IsPicture() significantly because by default IsPicture() will first ask all plugins if they can load the picture and then Hollywood's inbuilt image loader will be asked. Thus, you might want to disable plugins for IsPicture() by setting the Loader tag (see below) to Inbuilt. This means that IsPicture() will never ask any plugins if they can load the picture. Only Hollywood's very optimized inbuilt image loader will be asked in that case.

Starting with Hollywood 6.0 this function accepts an optional table argument which allows you to configure further options:

Loader:
This tag allows you to specify one or more format loaders that should be asked to load this picture. This must be set to a string containing the name(s) of one or more loader(s). You might want to set this to Inbuilt for the best performance, but then only formats supported by Hollywood's inbuilt image loader will be recognized (see above for details). Defaults to default. See Loaders and adapters for details. (V6.0)

Adapter:
This tag allows you to specify one or more file adapters that should be asked to open the specified file. This must be set to a string containing the name(s) of one or more adapter(s). Defaults to default. See Loaders and adapters for details. (V6.0)

See LoadBrush for a list of supported image formats.

Inputs
file$
file to check
table
optional: table configuring further options (V6.0)
Results
ret
True if the picture is in a supported format, False otherwise
table
table initialized with the fields listed above; only valid if first return argument is True (V4.5)

Show TOC