How to make image composition

Example requests & Code samples for GdPicture Toolkits.
Post Reply
Onier
Posts: 1
Joined: Fri Jul 18, 2008 11:54 am

How to make image composition

Post by Onier » Fri Jul 18, 2008 12:13 pm

I'm try to figure out, how to make a new image (let's say width 2390 pixels and height 1990 pixels - image1) and then resize an image (let's say width 1195 and height 1990) - image2) make 2 copies of it and then place them combined on the new created image (image1). I can't figure out how to do it. I hope somebody can help me with a tip.

Sorry for the bad english :wink:

Regards Onier

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How to make composition

Post by Loïc » Tue Jul 22, 2008 10:42 am

Hi,

I give you a vb sample to open an image and draw it 2 time on a new empty image.

You can modify this code easily in order to draw other image at other positions:

Code: Select all

Dim nSrcImage As Long
Dim nImageCanvas As Long
Dim nCanvasHeight As Long, nCanvasWidth As Long

nCanvasHeight = 1990
nCanvasWidth = 2390

nSrcImage = Imaging1.CreateImageFromFile("input.jpg")
nImageCanvas = Imaging1.CreateNewImage(nCanvasWidth, nCanvasHeight, 32, White)

Imaging1.SetNativeImage (nImageCanvas)
Call Imaging1.DrawImage(nSrcImage, 0, 0, nCanvasWidth / 2, nCanvasHeight, InterpolationModeHighQualityBicubic)
Call Imaging1.DrawImage(nSrcImage, nCanvasWidth / 2, 0, nCanvasWidth / 2, nCanvasHeight)

Imaging1.SaveAsJPEG ("output.jpg")
Imaging1.CloseImage (nSrcImage)
Imaging1.CloseImage (nImageCanvas)
Best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest