How to put text on image

dmuller

New Member
I need to develop a REST service that returns a kind of virtual card.
I can load a background image from the card with the "load-image" command, but I don't know how to put the data in the image to return the base64 file.
Is there a way to edit an image or save a screen frame as an image? Or any other suggestions to solve?

Diego Müller
 

Stefan

Well-Known Member
If your backend service can use .Net and if it can create an ABL window and if you can hoist this in a .Net window, then you may be able to use the CopyFromScreen method.
 

dmuller

New Member
I used the following source code and realized that it works on Windows, but I need it to work on Unix. It would be better to be able to place text directly on the image, without depending on the screen frame. Any suggestion?

Code:
USING System.Drawing.*.
USING System.Drawing.Imaging.*.
USING System.Windows.Forms.Screen.

DEFINE VARIABLE bmpScreenshot AS Bitmap NO-UNDO.
DEFINE VARIABLE gfxScreenshot AS Graphics NO-UNDO.

bmpScreenshot = NEW Bitmap(Screen:PrimaryScreen:Bounds:Width,
                           Screen:PrimaryScreen:Bounds:Height,
                           PixelFormat:Format32bppArgb).

gfxScreenshot = Graphics:FromImage(bmpScreenshot).

gfxScreenshot:CopyFromScreen(Screen:PrimaryScreen:Bounds:X,
                            Screen:PrimaryScreen:Bounds:Y,
                            0,
                            0,
                            Screen:PrimaryScreen:Bounds:Size,
                            CopyPixelOperation:SourceCopy).

/* Use ImageFormat:[Png|Gif|Bmp|Tiff] etc for different image formats */
bmpScreenshot:SAVE("C:\temp\Screenshot.png", ImageFormat:Png).
//bmpScreenshot:SAVE("\tmp\Screenshot.png", ImageFormat:Png).
 
Top