I wrote a VBA code to convert TIF to JPG, but it does not work. I get run time error 5 when I run my code. Can someone help me? I'm using Microstation v8i. My code is below one.
RasterManager.ExportRasterFile sourcefilename:=fpath & "\" & fname, destinationfilename:=fpath & "\" & fso.GetBaseName(fname) & ".jpg", NewFormatSpecifier:=RasterManager.RasterFormats.Find("JPEG(J)")
I read MicrostationVBA.chm and tried some ways, then I could save JPEG from TIFF using ExportRasterfile. The string 'JPEG(J)' is not wrong but I have to add some arguments to my code.
RasterManager.ExportRasterFile sourcefilename:=fname, _ destinationfilename:=outname, _ NewFormatSpecifier:=oRF, _ NewColorModeSpecifier:=oColor, _ NewCompressionModeSpecifier:=oCOMPRESS
I got RasterFormat from another JPEG raster. And I got ColorMode and CompressionMode from it, then I set them as the arguments for ExortRasterFile.
Then I excuted my improved code, it made JPEG from TIFF.
Answer Verified By: hirotaka nisimura