I have a situation where I am adding bulk .jpg images, 2 or 3 hundred at a time, to a folder for display in access in an image control.
If the images are too large, 3 or 4mb then they take too long to load
Using the software below to resize an image is reducing the mb size of the image even when the original is of similar pixel size to the output image.
E.g. an image of 998 x1200 and 1.5mb is resized to 998 x 1200 and 99kb. The resolution obviously suffers.
An image of 2997 x 3531 and 12.1mb is also reduced to 998 x 1200 and 99kb.
That large image reduced in external software is reduced to 998 x1200 1.7mb
Is there a better way to resize images on the fly.
If the images are too large, 3 or 4mb then they take too long to load
Using the software below to resize an image is reducing the mb size of the image even when the original is of similar pixel size to the output image.
E.g. an image of 998 x1200 and 1.5mb is resized to 998 x 1200 and 99kb. The resolution obviously suffers.
An image of 2997 x 3531 and 12.1mb is also reduced to 998 x 1200 and 99kb.
That large image reduced in external software is reduced to 998 x1200 1.7mb
Is there a better way to resize images on the fly.
Code:
Public Sub reSize(sInit As String)
Dim oWIA As Object
Dim oIP As Object
Dim nHeight As Integer
Dim nWidth As Integer
Dim sResize As String
nHeight = 1200
nWidth = 1800
Set oWIA = CreateObject("WIA.imagefile")
oWIA.LoadFile sInit
Set oIP = CreateObject("WIA.imageprocess")
oIP.Filters.Add oIP.FilterInfos("Scale").FilterID
oIP.Filters(1).Properties("MaximumHeight") = nHeight
oIP.Filters(1).Properties("MaximumWidth") = nWidth
Set oWIA = oIP.Apply(oWIA)
Kill sInit
oWIA.SaveFile sInit
Set oWIA = Nothing
End Sub