Customizing image block type to return full path

Hi there
I need the image block type to return an image path instead of just a filename.
Because I use kirby headless I don’t have access to methods like $file->url().

Here is an extract of the stringified JSON array of my blocks, containing an image block:

{
    "content": {
        "location": "kirby",
        "image": [
            "filename.png"
        ],
        "src": "",
        "alt": "",
        "caption": "",
        "link": "",
        "crop": "false"
    },
    "id": "4cb39fb8-d833-4b7d-b38c-8ad8bbf7d562",
    "isHidden": false,
    "type": "image"
}

Now I would like to change the image block type to return me the path instead of just the filename. Can I extend the image block type somehow?

Another idea would be to write a custom block type, where I hope to have full control over what is getting returned, including the ability to resize and crop images like I would like them to.

Thanks for any ideas to solve my problem and any hints on how to do that.

This question was indirectly asked in this thread: KQL plugin : how to get the image URL from the image block? - #2 by seriamlo

But as I don’t use the KQL Plugin but just need the image block to return a full path (I use robinscholzes betterRest plugin for a headless Kirby), I thought opening a new thread makes sense.

Actually the answer to this question, was answered in here:
https://forum.getkirby.com/t/create-custom-blocks-programmatically/22137/14