Solved

Creating one image file from two

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 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

10 Experts available now in Live!

Get 1:1 Help Now