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

* Purpose: Extremely useful when you need to send images via network commands such as `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 (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 a Captcha image to send to the automatic solving system via API

When you navigate to a website and encounter a Captcha in image form. 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: Fill in `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 converted into a long string of code in the format `data:image/png;base64,iVBORw0KGgoAAAANSU...` stored in the variable `$base64String`. The subsequent HTTP Request command will simply send this string neatly, helping the automated script easily bypass Captcha security layers.

<figure><img src="https://2961903581-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpIRrmOLZkhHBXdAiidIw%2Fuploads%2Fgit-blob-82f0d1c9b3988b4563dee25b80db7f9aa6d51f75%2Fis-02.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
