Converts an image from any image into any image using IrfanView command line (no GUI), (i_view32.exe).
Place code in VBA module and enjoy.
' Call below will convert a png image into bmp then deletes the png, having i_vew32.exe location in "Resources" folder next to active folder
' VBA Call ...
ConvertImage_IrfanView "C:\Folder1\image34.png", "bmp", 1
' Command line ...
' i_view32.exe C:\Folder1\image34.png /convert=C:\Folder1\image34.bmp
Sub ConvertImage_IrfanView(imageFile, Optional ConvertTo_ext = "jpg", Optional DeleteOrigin = 0, Optional IVFol = "Resources")
ThumImg = GetSon(imageFile) & "." & ConvertTo_ext
Cmd1 = FixPath(FixPath() & IVFol) & "i_view32.exe "
Cmd2 = ImageFile & " /convert=" & FixPath(GetPapa(ImageFile)) & ThumImg
Shell Cmd1 & Cmd2
If DeleteOrigin = 1 Then
Kill imageFile
End If
End Sub
' VBA Call ...
ConvertImage_IrfanView "C:\Folder1\image34.png", "bmp", 1
' Command line ...
' i_view32.exe C:\Folder1\image34.png /convert=C:\Folder1\image34.bmp
Sub ConvertImage_IrfanView(imageFile, Optional ConvertTo_ext = "jpg", Optional DeleteOrigin = 0, Optional IVFol = "Resources")
ThumImg = GetSon(imageFile) & "." & ConvertTo_ext
Cmd1 = FixPath(FixPath() & IVFol) & "i_view32.exe "
Cmd2 = ImageFile & " /convert=" & FixPath(GetPapa(ImageFile)) & ThumImg
Shell Cmd1 & Cmd2
If DeleteOrigin = 1 Then
Kill imageFile
End If
End Sub
imageFile, Optional ConvertTo_ext = "jpg", Optional DeleteOrigin = 0, Optional IVFol = "Resources"
ConvertImage_IrfanView "C:\Folder1\image34.png", "bmp", 1
Views 2,160
Downloads 662
CodeID
DB ID