If the generation process ends in the following error: Error[{"exceptionType":"System.LimitException","isUserDefinedException":false,"message":"mmdoc:Too many query rows: 50001","stackTrace":"(mmdoc)"}], the described solution fixes it as well.
Go to Query Builder tab and and click Add Query
For Object select ContentDocumentLink
For Field start writing down Content and click on ContentDocument ContentDocument ID>
In appeared Select Field field start writing down Latest and select LatestPublishedVersion LatestPublishedVersion ID>
In appeared Select Field field write down Version and select VersionData field
Save the Query
Go to the document in which you want to insert Image element and run Template Builder
Select Image element and in Source field select the added field from the Query
After you insert the element and generate the template, the uploaded image will be shown in the generated file