Classes

Method XbpBitmap():saveFile() Foundation

Saves a bitmap image in a file.

Syntax
:saveFile( <cImageFilename>, [<nFormat>|<cCodecUUID>], [<nCompression>] ) --> lSuccess
Parameters
<cImageFilename>
<cImageFilename> is a character string containing the name of the image file to be saved.
<nFormat>
<nFormat> indicates the bitmap data format for the image file. Constants listed in the following table can be used for this parameter. They are defined in the XBP.CH file:
Constants for image file formats
Constant Description
XBPBMP_FORMAT_GIF Graphics Interchange Format
XBPBMP_FORMAT_JPG Joined Photographic Experts Group
XBPBMP_FORMAT_PNG Portable Network Graphics
XBPBMP_FORMAT_BMP Windows bitmap file
XBPBMP_FORMAT_WIN2X Windows 2.x bitmap file
XBPBMP_FORMAT_WIN3X Windows 3.x bitmap file
XBPBMP_FORMAT_OS21X OS/2 1.x bitmap file
XBPBMP_FORMAT_OS22X OS/2 2.x bitmap file
XBPBMP_FORMAT_TIFF Tagged Image File file
XBPBMP_FORMAT_JPGXR JPEG Extended Range file
XBPBMP_FORMAT_DEFAULT *) Constant is independent of the operating system. Equivalent to XBPBMP_FORMAT_WIN3X under Windows
  1. Default
<cCodecUUID>
The parameter <nCodecUUID> specifies the operating system image encoder to use for encoding the resulting file. The parameter can be used instead of the <nFormat> parameter for selecting image formats other than the pre-defined formats. To do this, a character string must be assigned with the Universally Unique Identifier (UUID) of the Windows Imaging Component (WIC) codec. The UUID has the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
<nCompression>
<nCompression> is an optional parameter that defines the compression rate for image formats that support compression. This is a value from 0 to 100, with 0 being equivalent to "no compression" and 100 meaning "maximum compression". This parameter defaults to the #define constant XBPBMP_DEF_COMPRESSION from XBP.CH, which selects a format-specific default compression rate. Generally, this is an average compression rate that provides for reasonable compression speed while preserving image information.
Return

This method returns .T. (true) when the image could be saved, otherwise it returns .F. (false).

Description

The :saveFile() method saves the image displayed by an XbpBitmap object in an image file. Note that the method does not overwrite existing files. If the file <cImageFilename> exists already, it must be deleted before calling :saveFile().

The parameter <nCompression> is only important for image file formats which support data compression. These are PNG and JPEG formats, the latter of which exposes a reduced image quality with an increased compression rate.

Unlike the method :setBuffer()which only returns the actual image data for certain formats, the method :saveFile() always writes complete image files which can be read by other applications.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.