Image to base 64

hi! Is it possible to read a file and convert it to base 64?

See example below

Kind regards
Mattias

@Mattias_Larsson not sure if I fully understand, perhaps the example below helps.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://static.euronews.com/articles/stories/04/76/24/34/773x435_cmsv2_7228f4d1-47e6-571b-8642-67b55beedb75-4762434.jpg",
        "responseFormat": "file",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "fileName": "aja.jpg"
      },
      "name": "Write Binary File",
      "type": "n8n-nodes-base.writeBinaryFile",
      "typeVersion": 1,
      "position": [
        770,
        300
      ]
    },
    {
      "parameters": {
        "filePath": "aja.jpg"
      },
      "name": "Read Binary File",
      "type": "n8n-nodes-base.readBinaryFile",
      "typeVersion": 1,
      "position": [
        1010,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Write Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Binary File": {
      "main": [
        [
          {
            "node": "Read Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Hi i want to convert an image into a base64 file format then send it as base64.

On another workflow later I want to convert it back to an image.

Does it make it a bit more clear?

Yes makes sense. That can be done with the Move Binary Data Node.

Here an example:

4 Likes