Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Write text on a JPG and save it for printing purposes
Message
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01250668
Message ID:
01250897
Views:
29
This message has been marked as a message which has helped to the initial question of the thread.
Bhavbuti, Please test the sample below, it's very easy to understand.

Hope this helps

Cesar
DO LOCFILE("system.prg")
With _screen.System.Drawing

   LOCAL lcFile
   lcFile = GETPICT()

   LOCAL loSrcImg as xfcBitmap

   loSrcImg = .Bitmap.FromFile(lcFile)

   LOCAL lnWidth, lnHeight
   lnWidth  = loSrcImg.Width
   lnHeight = loSrcImg.Height

   LOCAL loNewBmp as xfcBitmap
   loNewBmp = .Bitmap.New(lnWidth, lnHeight + 30) && added 30 in height to acomodate your text

   LOCAL loGfx as xfcGraphics
   loGfx = .Graphics.FromImage(loNewBmp)
   
   loGfx.Clear(.Color.White) && White Background

   * Draw the image to the new Bitmap   
   loGfx.DrawImage(loSrcImg,0,0)
   
   * Draw text in bottom of new image
   loGfx.DrawString("GdiPlusX is cool !!!", .Font.New("Tahoma", 20), .Brushes.Blue, 0, lnHeight)
   
   loNewBmp.Save("c:\bhavbuti.jpg", .Imaging.ImageFormat.Jpeg)
ENDWITH
>Hi Cesar
>
>>>The particular blogs is here: http://weblogs.foxite.com/cesarchalom/archive/2007/07/27/4338.aspx
>>
>>That is a good point to start.
>>
>>Good luck, and again feel free to call again !
>
>Thanks it worked very well. Now I have 2 more requirements in the same vein.
>
>1. Add white space at the bottom of the image and write text to it, so for eg. a 640x480 image is now made 640x500, the image is not changed in anyway but additional 20 pixel height of white space is added and then text (as above) added to it.
>
>2. Is there any sample class already created that has an image in the background and the user can add text (user color, font, weight, size) at any place on the image.
>
>Please advise.
>
>Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform