I would like to convert BMP files to JPEG files in with no user active automatic
so it scans the a folder for bmp files and convert them to jpg and then delete the bmp files
deleting is the easy bit.
I have looked at other post that uses dll's and cannot get them to work not sure if becuase i am using
windows 7 to run them or if there is away with out using plug-ins
GDI+ has the function you need to convert BMP to JPG. I include a zip file with a VB project to use GDI+ to convert any format to any format (well not all formats but some)
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
GDI+ has the function you need to convert BMP to JPG. I include a zip file with a VB project to use GDI+ to convert any format to any format (well not all formats but some)
Nice. Regardless of whether it's any practical use, can formats other than bmp be taken as input?
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Windows has had a library for this for quite some time. It didn't come along in final form until after XP SP2, so you have to install it into XP but modern versions of Windows include it
Code:
Dim ImgF As WIA.ImageFile
Dim ImgP As WIA.ImageProcess
Set ImgF = New WIA.ImageFile
ImgF.LoadFile "Zapotec.bmp"
Set ImgP = New WIA.ImageProcess
With ImgP
.Filters.Add .FilterInfos!Convert.FilterID
.Filters.Item(1).Properties!FormatID.Value = wiaFormatJPEG
.Filters.Item(1).Properties!Quality.Value = 70
Set ImgF = .Apply(ImgF)
End With
ImgF.SaveFile "Zapotec.jpg"
There are several filters for scaling, cropping, stamping, and dealing with EXIF data and such in addition to simply doing format conversions.
Unlike API calls this can be used from VBScript as well.
It is called Microsoft Windows Image Acquisition Library v2.0 (wiaaut.dll).
The documentation is contained in the Windows SDK documentation. For some reason most VB programmers never bother to download and install SDKs though.
You can find the "web installer" there or read the fine print for a link to the ISO image (note: I added that link here). You normally only want the x86 SDK for VB6 development even if you are using 64-bit Windows.
You can also use the Vista SDK docs if you have those installed since Win7 didn't change much anyway, being a minor update.
Last edited by dilettante; Oct 21st, 2012 at 08:08 PM.
I got a LOT to learn, and GDI+ as well as SDKs are just the tip of the iceberg....thanks to all for guidance/links. TIME TIME TIME....I just wish I had the TIME.....!
Use the Dir-Function recursively with the *.bmp-Wildcard (you have to check if there are subfolders), and for every BMP-Filename returned replace the bmp-extension with jpeg, do your conversion, save it with the new jpeg-name
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Did you read post #2? Works GREAT....(and shows you that renaming the 'file' as xxxx.bmp to xxxx.jpg is what post #10 actually said....you can just change the xxxx's)
sorry bit confused on this could you please give me sample of code for Dir-Function recursively and where i would put the conversion bit of code thanks
@SamOscarBrown I have tried post 2 it works great for changing xxx.bmp to xxx.jpg
Regards
Steve
Last edited by sbarber007; Oct 22nd, 2012 at 01:57 PM.