This is a sample script for inserting a text on an image using Google Apps Script. The flow of this sample script is as follows:
- Retrieve the image size using ImgApp.
- Create new Google Slides with the custom page size using DocsServiceApp.
- Put the image and text.
- Export the result image
Source: Inserting Text on Image using Google Apps Script

Member of Google Developers Experts Program for Google Workspace (Google Apps Script) and interested in supporting Google Workspace Devs.