I'm trying to save to file a resized image loaded with LoadPicture
. With the following code I load the image and resize it but I now understood that Me.Image1.Width
resizes the image into the image box
control for displaying purposes only.
If I save the image with savepicture()
the image saved is the same as loaded image.
Private Sub CommandButtonImage_Click()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select a image"
.Filters.Add "Image", "*.gif; *.jpg; *.jpeg; *.png", 1
If .Show = -1 Then
' file has been selected
' fit image into image box
Me.Image1.PictureSizeMode = fmPictureSizeModeZoom
' display preview image in an image control
Me.Image1.Picture = LoadPicture(.SelectedItems(1))
' resize image
Me.Image1.Width = 50
Else
' something
End If
End With
End Sub