> ## 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.

# PrepareDib Method of the Engine Object

<Warning>
  This method is not implemented for Linux or macOS
</Warning>

This method creates a copy of the specified device-independent bitmap in [FineReader Engine internal image format](/fine-reader/engine/guided-tour/advanced-techniques/working-with-images#internal_format). DIB must be created using Windows API.

The output image obtained from this method may then be opened using the [IEngine::LoadImageDoc](/fine-reader/engine/api-reference/engine-object-iengine-interface/processing-methods/loadimagedoc-method) method.

## Syntax

### C++

```cpp theme={null}
HRESULT PrepareDib(
  __int64            DibHglobal,
  BSTR               DestinationFolderName,
  int                XResolution,
  int                YResolution,
  IPrepareImageMode* PrepareMode
);
```

### C\#

```csharp theme={null}
void PrepareDib(
  Int64            DibHglobal,
  string           DestinationFolderName,
  int              XResolution,
  int              YResolution,
  IPrepareImageMode PrepareMode
);
```

### Visual Basic .NET

```vb theme={null}
Sub PrepareDib( _
  DibHglobal As Int64, _
  DestinationFolderName As String, _
  XResolution As Integer, _
  YResolution As Integer, _
  [PrepareMode As IPrepareImageMode = Nothing] _
)
```

## Parameters

DibHglobal

\[in] Specifies the handle of the memory block (HGLOBAL) where the bitmap is saved. The handle is passed as [\_\_int64](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties). This handle should be available to the process that uses ABBYY FineReader Engine.

DestinationFolderName

\[in] Specifies the full path to the folder, where the image in internal format should be saved. This folder must exist; otherwise, an error code is returned.

XResolution

\[in] Specifies the horizontal resolution of the bitmap.

YResolution

\[in] Specifies the vertical resolution of the bitmap.

PrepareMode

\[in] Refers to the [PrepareImageMode](/fine-reader/engine/api-reference/image-related-objects/prepareimagemode) object that stores parameters for bitmap conversion in internal format. This parameter may be 0 in which case default parameters of the image preparation mode are used, or, if a [profile](/fine-reader/engine/guided-tour/advanced-techniques/working-with-profiles) has been loaded, the parameters set by this profile are used.

## Return values

Windows: 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).

Linux and macOS: This method returns E\_NOTIMPL.

## Remarks

* If you need to delete the files with prepared images when they are no longer necessary, implement the procedure in your application. These files will not be automatically removed from the disk by ABBYY FineReader Engine.
* This method does not work if the Engine object is loaded as an out-of-process server.

## See also

[Engine](/fine-reader/engine/api-reference/engine-object-iengine-interface)

[OpenDib](/fine-reader/engine/api-reference/engine-object-iengine-interface/processing-methods/opendib-method)

[LoadImageDoc](/fine-reader/engine/api-reference/engine-object-iengine-interface/processing-methods/loadimagedoc-method)

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