> 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-guide/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).

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

🎥 Watch the tutorial video: [Here](https://youtu.be/xWu0g35YTGo).

#### Configuration parameters:

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

#### Practical example: Converting a Captcha image to send to the automatic solving system via API

When you navigate to a website and encounter an image-based Captcha. 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 the 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 code like `data:image/png;base64,iVBORw0KGgoAAAANSU...` stored in the variable `$base64String`. The subsequent HTTP Request command simply sends this string neatly, helping the automated script 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-guide/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.
