generar bmp con texto

generar bmp con texto

Postby jpcavagnaro » Fri Aug 27, 2021 10:18 pm

Hola gente, necesito leer una imagen bmp/jpg agregarle un texto y guardarla.

Saludos.
Jorge
Jorge
Saludos.
jpcavagnaro
 
Posts: 155
Joined: Tue Oct 11, 2016 1:02 pm
Location: Luján, bs. as.

Re: generar bmp con texto

Postby nageswaragunupudi » Sat Aug 28, 2021 1:35 am

Code: Select all  Expand view
function TextOnImage()

   local hBmp
   local cSrcImage   := "c:\fwh\bitmaps\olga1.jpg"
   local cDstImage   := "olganame.jpg"
   local cText       := "Olga" + CRLF + "Kurylenko"
   local oFont, oLarg, oSmal

   DEFINE FONT oLarg NAME "VERDANA" SIZE 0,-50
   DEFINE FONT oFont NAME "TAHOMA"  SIZE 0,-30
   DEFINE FONT oSmal NAME "TAHOMA"  SIZE 0,-16

   hBmp  :=  FW_MakeYourBitmap( 352, 450, <|hDC, w, h |
               FW_DrawImage( hDC, cSrcImage, { 0, 0, h, w } )
               FW_SayText( hDC, cText, { 0, 0, h-30, w }, "B", { oLarg, oFont } )
               FW_SayText( hDC, "FWH Image Functions", { 30, 0, h, w }, "T", oSmal )
               return nil
               > )

   FW_SaveImage( hBmp, cDstImage, 100 )

   XImage( cDstImage )

   // cleanup
   DeleteObject( hBmp )
   RELEASE FONT oLarg,oFont, oSmal

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10619
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: generar bmp con texto

Postby jpcavagnaro » Sat Aug 28, 2021 10:12 am

Hola, me da error al compilar, por lo que leí tengo una versión vieja, tengo 17.09.

Alguna otra forma, se podrá.

Saludos
Jorge.
Jorge
Saludos.
jpcavagnaro
 
Posts: 155
Joined: Tue Oct 11, 2016 1:02 pm
Location: Luján, bs. as.

Re: generar bmp con texto

Postby Marc Venken » Sun Aug 29, 2021 9:13 am

Mr. Rao,

I looked into the source of : * imgtxtio.prg where these functions are. (shadow, ...) maybe some more fancy stuff

What approch would you suggest for generating (in a loop) several new image combined with (second jpg or textual) for having this kind of result :

https://www.maveco-webshop.be/outlet/schoenen/

The discount text is a second image that is merged by the shop software, but it can be only 1 merged item.

With FW i could generate the image from source with all items on it and than upload. ( discount, OnStock, Sold Out, Promotion )
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 54 guests