Here I leave a tutorial with the solution to my question (contains some adaptations I made to ease the process).
Tutorial
First Lazarus IDE has a tool named lazres.exe , located in the tools folder of Lazarus ( X: strong> \ Lazarus directory \ tools \ lazres.exe) - replace what is in bold with the Lazarus installation drive and directory.
After locating it I will be explaining briefly how LazRes works.
Introduction to LazRes
Its operation is by command lines and allows the creation of Lazarus Resources extension files - a kind of package creator allowing you to add all the resources you want (such as images, audios, videos, general files, etc.).
For the package creation two parameters for LazRes.exe , the LRS package name strong> and resources :
lazres.exe <nome_do_pacote.lrs> <arquivo1 arquivo2 arquivo3...>
Step 1: Preparing to create packages with a batch file
This step can be ignored if you know how to handle the command prompt and also lazres.exe
Copy and paste the code below into Notepad. You should save it in the same directory as the X: \ Lazarus directory \ tools) with the name of LRSBat.bat p>
LRSBat.bat :
@echo off
cls
pushd %~dp0
set l=^call lazres.exe
%l%
echo.
set /p f=Nome do Pacote ^(.lrs^):
set f=%f:.lrs=%
set f=%f%.lrs
@echo.
set a=
set p=
@echo.
echo Arraste um arquivo de cada vez e pressione ENTER para adicionar mais.
echo Quando finalizar digite /f/ e pressione ENTER para gerar o pacote final.
:addArquivos
set /p "a=Arquivo: "
if "%a%"=="/f/" (goto:criarLRS)
if exist %a% (set p=%p% %a% )
goto:addArquivos
:abort
exit
:criarLRS
echo ---------------------------------
%l% %f% %p%
echo.
echo ---------------------------------
ECHO Fim.
pause>nul
exit
Step 2: Creating your first package (using LRSBat.bat)
Run the LRSBat.bat as an administrator and follow the on-screen procedures. If successful, an LRS file will be created in the same directory with the chosen name.
Step 3: Implementing the LRS file (package) in the Lazarus project
Copy and paste the LRS file into your project folder.
With the project open in Lazarus and the code editor of the chosen unit
, you are incrementing the following lines:
uses ..., LResources;
. . .
{ Ao final do projeto antes do end. incluir as linhas abaixo }
initialization
{$I nomedopacote.lrs}
end.
This will allow you to compile the package_name.lrs package together with the project executable.
Step 4: Using an LRS Package File in the Project
For example, to add a package image file to a Lazarus image component, follow the procedures below. Suppose the image component is componenteDeImagem
and nome_do_arquivo
refers to the image name of the package (without the extension):
componenteDeImagem.Picture.LoadFromLazarusResource('nome_do_arquivo');
Regardless of the component being worked on, if you want to use a package file in the project you should use the LoadFromLazarusResource method.
References
link