convertToFile

convertToFile(filename: String;
              type:     Integer);

The convertToFile method of the Binary primitive type saves a copy of a binary picture image converted to the picture type specified in the type parameter, in the file specified in the filename parameter. If the filename parameter is null (""), the common File Save dialog is invoked, requesting the file name that is to be used to store the converted image.

The types of images that can be converted are as follows.

Use the PictureType_Bitmap, PictureType_Jpeg, PictureType_Jpeg2000, PictureType_Png, or PictureType_Tiff constant of the Window class to specify the picture type.

A 14015 (File does not contain an image type that can be handled) exception is raised if the receiver does not contain valid image data.

Converting to a .tif image type file results in a tiff packbits type image. Converting to a .jpg image results in loss of quality in the picture, as Joint Photographic Experts Group (JPEG) uses a lossy compression algorithm.

As the Portable Network Graphics image uses a lossless compression algorithm, it provides clarity and retains definition for images, but the files may be larger than JPEG files.

An exception is raised if this method is invoked from a server method.

You cannot convert images to GIF picture files.

See also the convertPicture method of the Binary primitive type.