Solved

Creating one image file from two

Posted on 2002-03-08
5
145 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

820 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