Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Interface and Graphics > Merge JPEG


Reply
 
Thread Tools Display Modes
  #1  
Old 06-20-2005, 05:40 PM
noodlesoup noodlesoup is offline
Newcomer
 
Join Date: Apr 2005
Posts: 16
Default Merge JPEG


I have two JPEG files. I will want to merge them into one JPEG or BMP files side by side. is it possible? any ideas?
Reply With Quote
  #2  
Old 06-23-2005, 04:17 PM
snarfblam's Avatar
snarfblam snarfblam is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Apr 2005
Location: USA
Posts: 866
Default

Yes. Create a bitmap (System.Drawing.Bitmap constructor) large enough to hold both. Create a graphics object on the bitmap (Graphics.FromImage), which you can use to draw both images into the bitmap (Graphics.DrawImage/DrawImageUnscaled). Save the image (Bitmap.Save). If you want to save a jpeg with a specific quality setting it goes something like this:

Code:
Sub SaveAsJpeg(ByVal MyImage As Bitmap, ByVal Quality As Integer, ByVal FileName As String) Dim ImageFormat As Imaging.ImageCodecInfo 'Find the codec For Each Format As Imaging.ImageCodecInfo In Imaging.ImageCodecInfo.GetImageEncoders() If Format.MimeType = "image/jpeg" Then ImageFormat = Format End If Next 'Set quality Dim Parameters As New Imaging.EncoderParameters Parameters.Param(0) = New Imaging.EncoderParameter(Imaging.Encoder.Quality, Quality) 'Save passing codec and parameters MyImage.Save(FileName, ImageFormat, Parameters) End Sub

If you have any other questions that MSDN can't answer, ask.
__________________
C# _VB.NET _
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->