Solved

Creating one image file from two

Posted on 2002-03-08
5
141 Views
Last Modified: 2010-05-02
I have 2 scanned images (tif format) and I want to transfer them to one larger file. So if each image is 100x100 pixels then the larger file would be say 200x100.

What's the easiest method please?
0
Comment
Question by:nickwoolley
5 Comments
 
LVL 1

Expert Comment

by:tandrei
ID: 6850535
Private Sub Command1_Click()
    Dim i As Integer, j As Integer
    picTarget.Width = Picture1.Width + Picture2.Width
    picTarget.Height = Picture1.Height
    For i = 0 To Picture1.Image.Height
        For j = 0 To Picture1.Image.Width
            picTarget.PSet (i, j), Picture1.Point(i, j)
        Next
        For j = 0 To Picture2.Image.Width
            picTarget.PSet (i, j + Picture1.Image.Width), Picture2.Point(i, j)
        Next
    Next

End Sub
'add 3 picture boxes on your form; Picture1 and Picture2 are autosize and load them with your images; it is slow, but should work
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 75 total points
ID: 6850860
You should be able to use PaintPicture to achieve this effect.

Start by loading one image into a picturebox.  Then load the other picture into a different picturebox.  Next, enlarge one of the pictureboxes so that it has enough room to hold the image of the other picturebox.  Finally, use PaintPicture to transfer the picture to the desired location, something like this:

Private Sub Command1_Click()
  Dim Picture1Height As Double
 
  Picture1Height = Picture1.Height
  Picture1.Height = Picture1.Height + Picture2.Height
  Picture1.PaintPicture Picture2.Picture, 0, Picture1Height
End Sub

Make sure the Picture1 has autoredraw set to true or the picture will probably disappear on refresh.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6851151
every picture question has a rspahitz's comment!
:))
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6851224
I guess I just have too much fun with it!
0
 

Author Comment

by:nickwoolley
ID: 6859985
rspahitz: That works for Pictureboxes, but what about image controls?
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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…

864 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

21 Experts available now in Live!

Get 1:1 Help Now