Merge images side by side issue

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Posts: 1
Joined: Tue Mar 17, 2009 2:34 pm

Merge images side by side issue

Post by yurab »

I'm trying to merge few images side by side. I figured, in order to have both images appear in place the first image should have max size of all combined images. Therefore I create NewBitmap in size of final image, and then add other image files on top of it. However there is one problem appears. Once I add new image which is smaller than the bottom one it automatically resize it to the size of the bottom image with background color. So the background color on sides of the new layer will cover the bottom layer one you finally merge all layers at the end. Opacity doesn't solve the problem. So I guess the solution is to make the background transparent. But it is not applicable with the MergeAddFile option. Any suggestions?

f0 = path & "\zz_0.jpg"
f1 = path & "\zz_1.jpg"
f2 = path & "\zz_2.jpg"
f3 = path & "\zz_3.jpg"
f4 = path & "\zz_4.jpg"
file = path & "\zz.jpg"

ctrl.NewBitmap 400,120
ctrl.UseTransparency = true
ctrl.SaveBitmap f0

ctrl.MergeAddFile f0,0,0,0
ctrl.MergeAddFile f4,25,0,0
ctrl.MergeAddFile f1,25,192,0
ctrl.MergeAddFile f2,25,226,0
ctrl.MergeAddFile f3,25,277,0
ctrl.SaveJPEGQuality = 95
ctrl.SaveBitmap file