Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Joining png files
Message
De
18/07/2005 13:41:11
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01033436
Message ID:
01033600
Vues:
15
Bo, a quick question - is this a VFP9 only solution or can it be made to work with VFP8 as well?

Thanks again


>>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
>
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform