Photos

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 3309
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Photos

Post by serge_girard »

Hi there,

Does somebody know how to put autograph (some text) on a JPG/BMP/PNG file. Preferably in batch, complete folder...

Thx/Serge
There's nothing you can do that can't be done...
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Photos

Post by gfilatov »

serge_girard wrote: Thu Jun 15, 2023 12:22 pm Hi there,

Does somebody know how to put autograph (some text) on a JPG/BMP/PNG file. Preferably in batch, complete folder...
Hi Serge,

I think it's possible with the great BosTaurus library.

Please take a look at the simple procedure below:

Code: Select all

/*
*/
DECLARE WINDOW _HMG_SPLASHWINDOW
/*
*/
Procedure textout()
LOCAL hDC, BTstruct
LOCAL hBitmap, hBitmap_aux
LOCAL nTypeText
LOCAL nAlingText
LOCAL nOrientation
LOCAL nW := BT_BitmapWidth(_HMG_SPLASHWINDOW.IMAGE.hBitmap)
LOCAL nH := BT_BitmapHeight(_HMG_SPLASHWINDOW.IMAGE.hBitmap)

   // Create bitmap in memory
   hBitmap := BT_BitmapCreateNew (nW, nH, WHITE)

   // Create hDC to a bitmap
   hDC := BT_CreateDC (hBitmap, BT_HDC_BITMAP, @BTstruct)     

     // Paste image
     hBitmap_aux := BT_BitmapLoadFile ("Splash")  // load from resource
        BT_DrawBitmapTransparent (hDC, 0, 0, nW, nH, BT_SCALE, hBitmap_aux, NIL)
     BT_BitmapRelease (hBitmap_aux)

     // Draw Text
     nTypeText    := BT_TEXT_TRANSPARENT + BT_TEXT_BOLD + BT_TEXT_ITALIC
     nAlingText   := BT_TEXT_LEFT + BT_TEXT_TOP
     nOrientation := BT_TEXT_NORMAL_ORIENTATION
     BT_DrawText (hDC, 450, 350, "EXTENDED", "Times New Roman", 18, BLACK, WHITE, nTypeText, nAlingText, nOrientation)

      BT_BitmapSaveFile( hBitmap, "test.png", BT_FILEFORMAT_PNG )
   // Release hDC bitmap
   BT_DeleteDC (BTstruct)

   _HMG_SPLASHWINDOW.IMAGE.hBitmap := hBitmap
   _HMG_SPLASHWINDOW.IMAGE.Refresh()

Return
The splash screen resource before conversion is shown below:
hmgsplash.png
hmgsplash.png (179.1 KiB) Viewed 3577 times
and the result image with added text is
test.png
test.png (187.76 KiB) Viewed 3577 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
serge_girard
Posts: 3309
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Photos

Post by serge_girard »

Thanks Grigory, I will try !

Serge
There's nothing you can do that can't be done...
Red2
Posts: 281
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Photos

Post by Red2 »

Hello All,

I am very interested in this but could not run the code in "Official HMG".

The sample code eventually compiled when I changed "dot separated" syntax such as
_HMG_SPLASHWINDOW.IMAGE.hBitmap
into GetProperty(...) syntax.

However I cannot fix the following _HMG_SPLASHWINDOW error:
2023-06-15.png
2023-06-15.png (10.05 KiB) Viewed 3558 times
Any help on what I am missing would be greatly appreciated!
Thank you!
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Photos

Post by gfilatov »

Hello Spencer,

Thanks for your interest.

You can find the source code for this example along with the executable in the attachment below.

But the above code is for use with MiniGUI Extended Edition. :o
Attachments
SPLASHDEMO.ZIP
Splash demo example
(1.24 MiB) Downloaded 111 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Red2
Posts: 281
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Photos

Post by Red2 »

Thank you very much Gregory!!!
User avatar
serge_girard
Posts: 3309
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Photos

Post by serge_girard »

Hi,

I'm adapting to my needs: row, col, text, color, font, size,.... will all be variable and to be edited on form.
Next step is to 'stamp' all (or some) photo with this text.

Serge
There's nothing you can do that can't be done...
User avatar
serge_girard
Posts: 3309
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Photos

Post by serge_girard »

Grigory,

Any idea how to 'undo' or reset some mistaken text (when not yet save of course) ?

Serge
There's nothing you can do that can't be done...
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Photos

Post by gfilatov »

Serge,

Please take a look at the updated sample with Undo effect in the attachment.

Hope that give you some idea :idea:
Attachments
SPLASHDEMO_2.ZIP
Show some text on the image and then reset this text
(1.24 MiB) Downloaded 128 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Photos

Post by AUGE_OHR »

hi,

can not open ZIP Files as Windows Defender give a Error Message about "Trojan_WACATAC.B!ML"
Trojan_WACATAC.B!ML.jpg
Trojan_WACATAC.B!ML.jpg (15.56 KiB) Viewed 3497 times
have fun
Jimmy
Post Reply