Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: ImageMagick COM Object Convert Image BMP GIF JPG PNG
; How to get the ImageMagick COM Object working in WinBatch ... ; ... at least in this small example ; ... to convert BMP to JPG and PNG. ; ; Detlev Dalitz.20090717 ; Create temporary folder. strFolderTemp = Environment ("TEMP") : "\OWL\" blnResult = DirMake (strFolderTemp) blnResult = DirChange (strFolderTemp) ; Use existing image filename. strFileBMP = "WBOwl.bmp" ; Copy file from source folder to temporary folder. blnResult = FileCopy (DirHome () : strFileBMP, strFolderTemp, @FALSE) ; Prepare other image file types. strFileJPG = ItemReplace ("jpg", -1, strFileBMP, ".") strFilePNG = ItemReplace ("png", -1, strFileBMP, ".") ; Invoke IM COM object. objIM = ObjectCreate ("ImageMagickObject.MagickImage.1") ; Note: Once the following statement has been executed ; the COM object is corrupted and cannot be used further more. ;strMsg0 = objIM.Convert(strFileBMP, strFileJPG) ; Forbidden usage. ; Note: The empty string as the first parameter makes it working! strMsg1 = objIM.Convert("", strFileBMP, strFileJPG) strMsg2 = objIM.Convert("", strFileBMP, strFilePNG) Drop (objIM) ; Explore temporary folder. intPID = RunShell ("explorer.exe", '/e,/select,"' : strFolderTemp : strFileBMP : '"', "", @ZOOMED, @GETPROCID) Message ("Demo: IM COM object", "Press Ok to remove temporary files and folder.") ; Delete files and folder blnResult = FileDelete (ItemReplace ("*", -1, strFileBMP, ".")) blnResult = DirChange ("..") blnResult = DirRemove (strFolderTemp) ; Close explorer. TimeDelay (3) blnResult = WinClose (FindWindow ("ExploreWClass")) Exit
Article ID: W18075
Filename: Convert Images.txt
File Created: 2019:12:02:11:30:14
Last Updated: 2019:12:02:11:30:14