> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-en/action-guides/image-search/image-to-base64.md).

# Image to Base64

This action helps you encode an image file on your computer into a long text string (Base64 string).

* Purpose: Extremely useful when you need to send images over network commands like `HTTP Request`. For example, you want to send an image to AI services for captcha decoding, or upload an image to a server without transmitting the file in the usual way.

#### Configuration Parameters:

* Image Path: The absolute path to the image file on your computer that needs to be converted (e.g., `D:\GPM_Data\captcha.png`).
* Output variable: The name of the variable that will store the Base64 string after successful encoding.

#### Practical Example: Converting Captcha Image to Send to the Automated Solving System via API

When you navigate to a website and encounter an image-based Captcha code. You have used the Screenshot action to capture the area containing the Captcha code and saved it as an image file at `D:\GPM_Data\captcha.png`. Now, you want to send this image to a third-party API (like 2Captcha, Anti-Captcha) for them to solve it for you. Since their API requires image data to be in the form of a Base64 text string, you will configure it as follows:

* Step 1: Call the Image to Base64 action.
  * Image Path: Enter `D:\GPM_Data\captcha.png`.
  * Output variable: Name the variable `base64String`.
* Step 2: Call the HTTP Request action (Method POST) to send the data to the captcha solving server. In the Data (Body) section, you pass the variable `$base64String` into the JSON structure according to their API documentation.

Result: The image file `captcha.png` will be broken down into a long string of characters in the form `data:image/png;base64,iVBORw0KGgoAAAANSU...` stored in the variable `$base64String`. The subsequent HTTP Request command simply sends this string neatly, allowing the automated script to easily bypass captcha security layers.

<figure><img src="/files/Sah0YoKXR0m1eaPxJSRo" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-en/action-guides/image-search/image-to-base64.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
