Images loading

Hi All,

I am dealing with images first time.

I have to load images from two folders say folder1 and folder2 and view it in picturebox1 and picturebox2, Then on button click event of next and previous I have to view images from both the pictureboxes as i have to do visual compariosion of the images.

Can anyone please provide me examples for the same or any references for the same. Also supports for max images(bmp, png, svg, jpeg, jpg....)

Thanks,
Shailesh
[498 byte] By [ShaileshShinde] at [2007-11-19 14:05:19]
# 1 Re: Images loading
To load a picture into a picturebox you could use:
Dim NewImage As Image = Image.FromFile("Loacation and name of picture file")
PictureBox1.Image = NewImage

'OR
PictureBox1.Image = Image.FromFile("Loacation and name of picture file")

I'm not sure I understand the Comparison part :confused:
What do you want to compare
HanneSThEGreaT at 2007-11-10 3:16:07 >
# 2 Re: Images loading
Hi,

About comparision.

I have to compare size, height, width and variation.
Also I have to display folder1 image properties on status bar.

Thanks
Shailesh
ShaileshShinde at 2007-11-10 3:17:07 >
# 3 Re: Images loading
You can use:
Private Function loadImage(ByVal iFileName As String) As Boolean
Try
Dim pImgImage As Image
pImgImage = Image.FromFile(iFileName)
cIntImageHeight = pImgImage.Height
cIntImageWidth = pImgImage.Width
PictureBox1.Image = pImgImage
Return True
Catch
Return False
End Try
End Function
'The call in button click
loadImage("path and name of image file")
To obtain Height and width info of the picture
HanneSThEGreaT at 2007-11-10 3:18:03 >
# 4 Re: Images loading
Hi,

With the given code I have tried this:

Private Sub btnInputSource_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInputSource.Click
openFileDialog1.Multiselect = True
If openFileDialog1.ShowDialog() = DialogResult.OK Then
If Not (openFileDialog1.FileNames Is Nothing) Then
Dim i As Integer
For i = 0 To openFileDialog1.FileNames.Length - 1
loadImage(OpenFileDialog1.FileNames(i))
Next i
Else
loadImage(OpenFileDialog1.FileName)
End If
End If
End Sub

Private Function loadImage(ByVal iFileName As String) As Boolean
Dim cIntImageHeight As Integer
Dim cIntImageWidth As Integer
Try
Dim pImgImage As Image
pImgImage = Image.FromFile(iFileName)
cIntImageHeight = pImgImage.Height
cIntImageWidth = pImgImage.Width
PictureBox1.Image = pImgImage
Return True
Catch
Return False
End Try
'The call in button click
loadImage("iFileName")
End Function

The Above code displays the image in PictureBox1. Here I have loaded multiple images how will i display them on button next.

Thanks,
Shailesh
ShaileshShinde at 2007-11-10 3:19:09 >