Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Joining png files
Message
 
To
18/07/2005 02:14:14
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01033436
Message ID:
01033523
Views:
12
This message has been marked as the solution to the initial question of the thread.
>Hi All
>
>If I have 4 png files which are all the same height and width is there a way to join them together lengthwise into a single png image ie. join them together from left to right?
>
>If not, would changing them to gif, jpeg, or bmp make it possible?

Here is some code that will do it using the VFP9 FFC GdiPLus classes:
** Source Images
cPic1 = GETPICT()
cPic2 = GETPICT()
cPic3 = GETPICT()

** Destination image
cPicSave = PUTFILE("Image","output.png","png")

SET CLASSLIB TO (HOME()+"\ffc\_gdiplus")

** Open source images
oPic1 = CREATEOBJECT("GpImage")
oPic1.CreateFromFile(cPic1)
oPic2 = CREATEOBJECT("GpImage")
oPic2.CreateFromFile(cPic2)
oPic3 = CREATEOBJECT("GpImage")
oPic3.CreateFromFile(cPic3)

** Create a new bitmap
oBmp = CREATEOBJECT("GpBitmap")
nWidth = ;
   oPic1.ImageWidth + ;
   oPic2.ImageWidth + ;
   oPic3.ImageWidth
nHeight = MAX( ;
   oPic1.ImageHeight, ;
   oPic2.ImageHeight, ;
   oPic3.ImageHeight)
oBmp.Create(nWidth,nHeight)

oGfx = CREATEOBJECT("GpGraphics")
oGfx.CreateFromImage(oBmp)

** Draw image 1
nLeft = 0
oGfx.DrawImageScaled(oPic1, ;
   nLeft,0,oPic1.ImageWidth,oPic1.ImageHeight)
nLeft = nLeft + oPic1.ImageWidth

** Draw Image 2
oGfx.DrawImageScaled(oPic2, ;
   nLeft,0,oPic2.ImageWidth,oPic2.ImageHeight)
nLeft = nLeft + oPic2.ImageWidth

** Draw Image 3
oGfx.DrawImageScaled(oPic3, ;
   nLeft,0,oPic3.ImageWidth,oPic3.ImageHeight)

** Save destination image
oBmp.SaveToFile(cPicSave,"image/png")


oGfx = NULL
oBmp = NULL
oPic1 = NULL
oPic2 = NULL
oPic3 = NULL
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform