Creates a thumb of an image using IrfanView
Thumbnail filename will have _th at end of filename
Having i_view32.exe file (attached) in a subfolder next to workbook
' Below code will ...
' Create thumbnail for image34.png and save it as image34.png_th.png with h=180 and W=180 using i_view32.exe that is found in folder "Resources" next to ThisWorkbook.Path
' VBA Call ...
' CreateThumb_IrfanView "C:\Folder1\image34.png", 180, 180
' Command line ...
' i_view32.exe C:\Folder1\image34.png /resize=(180,180) /aspectratio /convert=C:\Folder1\image34.png_th.png
Sub CreateThumb_IrfanView(ImageFile, Optional Wi=200, Optional He=200, Optional IVFol = "Resources")
ThumImg = GetSon(imageFile) & "_th." & Right(ImageFile, 3)
Cmd1 = FixPath(FixPath() & IVFol) & "i_view32.exe "
Cmd2 = ImageFile
Cmd3 = " /resize=(" & Wi & "," & He & ") /aspectratio /convert="
Cmd4 = FixPath(GetPapa(ImageFile)) & ThumImg
Shell Cmd1 & Cmd2 & Cmd3 & Cmd4
DoEvents
End sub
' Create thumbnail for image34.png and save it as image34.png_th.png with h=180 and W=180 using i_view32.exe that is found in folder "Resources" next to ThisWorkbook.Path
' VBA Call ...
' CreateThumb_IrfanView "C:\Folder1\image34.png", 180, 180
' Command line ...
' i_view32.exe C:\Folder1\image34.png /resize=(180,180) /aspectratio /convert=C:\Folder1\image34.png_th.png
Sub CreateThumb_IrfanView(ImageFile, Optional Wi=200, Optional He=200, Optional IVFol = "Resources")
ThumImg = GetSon(imageFile) & "_th." & Right(ImageFile, 3)
Cmd1 = FixPath(FixPath() & IVFol) & "i_view32.exe "
Cmd2 = ImageFile
Cmd3 = " /resize=(" & Wi & "," & He & ") /aspectratio /convert="
Cmd4 = FixPath(GetPapa(ImageFile)) & ThumImg
Shell Cmd1 & Cmd2 & Cmd3 & Cmd4
DoEvents
End sub
ImageFile, Optional Wi, Optional He, Optional IVFol
CreateThumb_IrfanView "C:\Folder1\image34.png", 180, 180
Views 3,636
Downloads 1,436
CodeID
DB ID