473,473 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Merge Images

Hi

I want to write an application that can merge two images with a bit of
re-sizing and changing of opacity thrown in for good measure.

I have a backdrop that can be in any format and an overlay image that will
be a 48x48 png file.

I want to take the overlay image, resize it to about 130x130, set the
opacity to 20% and then place this image onto the back drop about 30px the
edges in the bottom left corner. The final task would be to save this image
to disk.

Does anyone have any ideas/concepts on the best way to achieve this?

Regards, Carl Gilbert
Nov 21 '05 #1
3 2927
Hi

Drawing Transparent Images and Shapes using Alpha Blending
http://www.vbdotnetheaven.com/Code/Aug2003/2149.asp

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim bgImg As New Bitmap("Back.png")
'Because FromImage did not support all format, we need to convert it first.
bgImg.Save("c:\test.jpg", ImageFormat.Jpeg)
bgImg = Image.FromFile("c:\test.jpg")
Dim g As Graphics = Graphics.FromImage(bgImg)
Dim fgImg As New Bitmap("mario.jpg")

Dim ptsArray As Single()() = {New Single() {1, 0, 0, 0, 0}, New
Single() {0, 1, 0, 0, 0}, New Single() {0, 0, 1, 0, 0}, New Single() {0, 0,
0, 0.5F, 0}, New Single() {0, 0, 0, 0, 1}}
Dim clrMatrix As New ColorMatrix(ptsArray)
Dim imgAttributes As New ImageAttributes
imgAttributes.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default,
ColorAdjustType.Bitmap)
g.DrawImage(fgImg, New Rectangle(0, 0, 100, 100), 0, 0,
fgImg.Width, fgImg.Height, GraphicsUnit.Pixel, imgAttributes)
Me.PictureBox1.Image = bgImg
' Or Save the bgImg directly
End Sub

For the detailed information about ColorMatrix, you may take a look at the
link below.
Using a Color Matrix to Set Alpha Values in Images
http://msdn.microsoft.com/library/de...us/gdicpp/GDIP
lus/usingGDIPlus/alphablendinglinesandfills/usingacolormatrixtosetalphavalue
sinimages.asp
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2


Thanks for the reply Peter. Your code worked just fine. Thats saved me
hours of messing about in Photoshop all the time.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #3
Hi Carl,

Thanks for your quickly reply!
I am glad that my suggestion helps you.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Morris | last post by:
Does anyone know whether it is possible to effect a mail merge to MSWord using VBScript in an asp file? I know it is possible to produce a doc file and force a download using ...
8
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for...
3
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
2
by: Imtiaz | last post by:
Hi, I have two JPEG Images. Now I wanted to merge them into one image. I am trying to use Image.SaveAdd to do this. But it is throwing an exception "Invalid parameter used." Following is the...
4
by: John J. Hughes II | last post by:
Could someone explain how to merge the form menu with the mdi container window. The menu strip items on the form window merge but I either end up with a blank blue menu on the form or top list of...
0
by: Zeeway | last post by:
hi,everyone I have a question about merging images. I want to merge serval tiff images into one file using C#,that means the final file has multiple frames.My problem is that I want each frame in...
0
by: =?Utf-8?B?Sm9uIEphY29icw==?= | last post by:
I load a bitmap from a file and display it in a PictureBox: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Fn As String =...
1
by: cristalink | last post by:
Hi, I have MS Visual Studio 2008 both Pro and Dev Team Edition SP1 installed. I've compiled a managed C++ .DLL which automatically had a manifest embedded, with the following dependency:...
5
by: madhav001 | last post by:
Hi, I am biginner in C++ and I tried to combine two memory buffers of TIFF image data to one so that to save it as one image. ie: left half image + right half image = a full image. That was not...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.