Solved

Joining Images.....

Posted on 2004-08-13
2
205 Views
Last Modified: 2010-05-02
I have a few Images with names as Pic11, Pic12, Pic13, Pic21, Pic22, Pic23, Pic 31, Pic32, Pic33
They are all present in one folder let's say "C:\Imran"
They are basically parts of one big image......

They should be joined like this......

Pic11       Pic12         Pic13

Pic21       Pic22         Pic23

Pic31       Pic32         Pic33

to make a big picture and there should be no gap (white pixel array) between these pictures......

Currently I am using Phototshop to join these Pictures but I am sure it can be done in VB very easily....

Any solution with PictureBox/Image Box or anything else that returns me a Picture that is made up of joining these small parts is acceptable to me......
and note that all of these are BMP and the resultant Picture should also be a BMP.......

Imran Arshad
0
Comment
Question by:imarshad
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 11792701
I  have modified on of my previous solutions to suit your needs:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20912572.html

The following project needs a PictureBox and a CommandButton:

Option Explicit

Private Const picCols = 3
Private Const picRows = 3
Private Const picWidth = 20  ' <-------- Change this to the width of your images
Private Const picHeight = 25 ' <-------- Change this to the height of your images

Private Sub Form_Load()
    Me.ScaleMode = vbPixels
    Picture1.Appearance = 0 ' Flat
    Picture1.BorderStyle = 0 ' None
    Picture1.ScaleMode = vbPixels
    Picture1.Width = picCols * picWidth
    Picture1.Height = picRows * picHeight
    Picture1.AutoRedraw = True
End Sub

Private Sub Command1_Click()
    Dim x As Integer
    Dim y As Integer
    Dim c As Integer
    Dim f As String
    Dim p As String
         
     
    c = 1
    p = "C:\Imran\"
    For y = 1 To picRows
        For x = 1 To picCols
            f = "Pic" & ((y * 10) + x) & ".bmp"
            If Dir(p & f) <> "" Then
                Picture1.PaintPicture LoadPicture(p & f), (x - 1) * picWidth + 1, (y - 1) * picHeight + 1
            Else
                MsgBox "File " & p & f & " not found"
            End If
            c = c + 1
        Next x
    Next y
   
    Picture1.Picture = Picture1.Image
    SavePicture Picture1.Image, p & "Joined.bmp"
End Sub
0
 
LVL 13

Author Comment

by:imarshad
ID: 11796933
Thanks Mike,
                      It works great.......Saves quite a bit of time for me........
Imran Arshad
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now