Can you add text to a specific area of an image with the shell?

I’m interested in using my desktop (picture) as feedback and to update with daily events. I know how to do this in Photoshop, but I wanted to see if an alternate method exists. Can an area be defined with SIPS (or whatever), say an inch or so from the bottom left of the image, and text be overlaid onto an image? TIA

I don’t know about sips, but you can do it using ASObjC.

It was a bit rude not to post some sample code:

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"

set theFile to POSIX path of (choose file with prompt "Choose an image file")
-- build path for exported image
set theFile to current application's NSString's stringWithString:theFile
set newPath to (theFile's stringByDeletingPathExtension()'s stringByAppendingString:"-out")'s stringByAppendingPathExtension:"jpg"
-- make NSString of the text, and define text attributes
set theNSString to current application's NSString's stringWithString:"Hello world"
set theNSFont to current application's NSFont's fontWithName:"Helvetica" |size|:48
set theNSColor to current application's NSColor's redColor()
set attributesNSDictionary to current application's NSDictionary's dictionaryWithObjects:{theNSFont, theNSColor} forKeys:{current application's NSFontAttributeName, current application's NSForegroundColorAttributeName}
-- load the image
set theNSImage to current application's NSImage's alloc()'s initWithContentsOfFile:theFile
-- draw the text; change point to suit, remembering y 0 is at bottom
theNSImage's lockFocus()
theNSString's drawAtPoint:{72, 72} withAttributes:attributesNSDictionary
theNSImage's unlockFocus()
-- get the bitmap as data
set theNSData to theNSImage's TIFFRepresentation()
-- make a bitmap image representaion from the data
set theNSBitmapImageRep to (current application's NSBitmapImageRep's imageRepsWithData:theNSData)'s objectAtIndex:0
-- create jpeg data from the bitmap image rep
set newNSData to theNSBitmapImageRep's representationUsingType:(current application's NSJPEGFileType) |properties|:{NSImageCompressionFactor:0.8, NSImageProgressive:false}
-- save it to a file
newNSData's writeToFile:newPath atomically:true

Neat. Thank you for the commented example.

This is great.
How would we edit that script to overlay ONLY the filename ?

Model: 2012 Mini
AppleScript: 2.7
Browser: Safari 605.1.15
Operating System: macOS 10.14

I’ve used Acorn, Intaglio, and imagemagick to do this. Only imagemagick is a free app, though.