Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating one image file from two

Posted on 2002-03-08
5
Medium Priority
?
149 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 300 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

927 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