Hi Christof
Wonder if you can help - I now have VFP9 - here is my code
* Initalize GDI+
Set CLASSLIB to "_Gdiplus.vcx" Additive
* Load the original image
Local loFile
loFile = CreateObject("gpBitmap")
loFile.CreateFromFile("im002.bmp")
* new bitmap 3 times as large (scale factor 200%)
Local loBitmap
loBitmap = CreateObject("gpBitmap")
loBitmap.Create(loFile.ImageWidth*3,loFile.ImageHeight*3)
* insert the scaled image into the new bitmap
Local loGP
loGP = CreateObject("gpGraphics")
loGP.CreateFromImage( m.loBitmap )
loGP.DrawImageScaled( m.loFile, 0,0,loFile.ImageWidth*3,loFile.ImageHeight*3 )
* Save as JPG.
loBitmap.SaveToFile("test.jpg","im20.jpg")
I get this error
GDI + Object not created or associated
gpBitmap
Thanks
Colin
>Hi Colin,
>
>>I need to be able to resize a JPG file from a VFP6 app? I presume I have to do this by calling 3rd pary software - if so what software would you recommend?
>
>If you also have VFP 9, you can use the gdiplus foundation classes. I haven't checked how much of the code needs to be changed for VFP 6. If it's too much, you can still create a COM server in VFP 9 and deploy it with your application. Here's the code to resize an image:
>
>* Initalize GDI+
>Set CLASSLIB to "_Gdiplus.vcx" Additive
>
>* Load the original image
>Local loFile
>loFile = CreateObject("gpBitmap")
>loFile.CreateFromFile("delete.bmp")
>
>* new bitmap 3 times as large (scale factor 200%)
>Local loBitmap
>loBitmap = CreateObject("gpBitmap")
>loBitmap.Create(loFile.ImageWidth*3,loFile.ImageHeight*3)
>
>* insert the scaled image into the new bitmap
>Local loGP
>loGP = CreateObject("gpGraphics")
>loGP.CreateFromImage( m.loBitmap )
>loGP.DrawImageScaled( m.loFile, 0,0,loFile.ImageWidth*3,loFile.ImageHeight*3 )
>
>* Save as JPG.
>loBitmap.SaveToFile("test.jpg","image/jpeg")
>
Specialist in Advertising, Marketing, especially Direct Marketing
I run courses in Business Management and Marketing