> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WriteToFile Method of the Image Object

This method saves a copy of the current image plane into an image file in the specified format.

<Warning>
  You cannot use this method to save an image-only PDF file. It can be done by using one of the export methods, for example, [Export](/fine-reader/engine/api-reference/document-related-objects/frpage/export-method) method of the corresponding [FRPage](/fine-reader/engine/api-reference/document-related-objects/frpage) object with [IPDFExportParams::TextExportMode](/fine-reader/engine/api-reference/parameter-objects/export-parameters/pdfexportparams#textexportmode) set to PEM\_ImageOnly.
</Warning>

## Syntax

### C++

```cpp theme={null}
HRESULT WriteToFile(
  BSTR                FileName,
  ImageFileFormatEnum Format,
  IImageModification* Modification,
  IUnknown*           ExtendedParams
);
```

### C\#

```csharp theme={null}
void WriteToFile(
  string              FileName,
  ImageFileFormatEnum Format,
  IImageModification   Modification,
  object              ExtendedParams
);
```

### Visual Basic .NET

```vb theme={null}
Sub WriteToFile( _
  FileName As String, _
  Format As ImageFileFormatEnum, _
  [Modification As IImageModification = Nothing], _
  [ExtendedParams As Object = Nothing] _
)
```

## Parameters

FileName

\[in] This parameter contains the full path to the image file where the image is to be saved. Examples: C:\MyPictures\MyPic.bmp. If a file in this path already exists, it is overwritten without prompt.

Format

\[in] A variable of the [ImageFileFormatEnum](/fine-reader/engine/api-reference/enumerations/imagefileformatenum) type that specifies the format of the output file. Not all formats defined by this enumeration are supported for writing.

Modification

\[in] This parameter of the [ImageModification](/fine-reader/engine/api-reference/image-related-objects/imagemodification) type defines modifications that are performed upon image before writing it into file. This parameter is optional and may be 0, in which case no modifications are performed upon image.

ExtendedParams

\[in] This variable may refer to a [JpegExtendedParams](/fine-reader/engine/api-reference/image-related-objects/jpegextendedparams), [PngExtendedParams](/fine-reader/engine/api-reference/image-related-objects/pngextendedparams), or [TiffExtendedParams](/fine-reader/engine/api-reference/image-related-objects/tiffextendedparams) object that defines parameters for saving the image to JPEG, PNG, or TIFF format, respectively. This parameter is optional and may be 0. In this case, the image is saved with lossless JPEG 2000 compression, in case of JPEG, without transparency, in case of PNG, or with default quality, in case of TIFF.

<Warning>
  In Linux, if you are working with ABBYY FineReader Engine loaded out-of-process, you must pass NULL for this parameter.
</Warning>

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FineReader Engine functions](/fine-reader/engine/api-reference/return-codes).

## See also

[Working with Images](/fine-reader/engine/guided-tour/advanced-techniques/working-with-images)

[ImageFileFormatEnum](/fine-reader/engine/api-reference/enumerations/imagefileformatenum)

[ImageModification](/fine-reader/engine/api-reference/image-related-objects/imagemodification)
