the user interface composition is trivial (some labels, some textboxes, a checkbox and an image control): you should be able to create it from scratch if you learnt the basics of UI design on any "hello world" tutorial for VB.NET (for example, try these articles: and ) the Image Batch Resizer is a very simple one-form Windows Forms Application written in VB.NET I have no time to write down a document on that, but you have to consider the following: If this is not the desired behavior, and you need to preserve in the output result the folder structure of the source input pictures tree, you will have to modify the call to "ToFile(.)" in order to use a destination folder that contains the desired substring path of the input folder. Of course, in this example, the output path will be the same for all the generated pictures (resulting in a flattened folder structure in the generated output). ' Scan all the subdirectories, call recursively Scandirĭim paths As String() = Directory.GetDirectories(Path) Private Sub ScanDir(ByVal Path As String)ĭim fs As String() = Directory.GetFiles(Path, " *.jpg")įshort = Ffull.Substring(Ffull.LastIndexOf( " \") + 1)ĭr = MessageBox.Show("Convert? ", Fshort, _ MessageBoxButtons.OK, MessageBoxIcon.Exclamation) MessageBox.Show( " The folder.", " Error", _ Not Directory.Exists(txtOUTpath.Text) Then If Not Directory.Exists(txtINpath.Text) Or _ Object, _īyVal e As System.EventArgs) Handles btnGo.Click Private Sub btnGo_Click(ByVal sender As System. The core reducing functionality is inside the Reduce() subroutine, specifically in this line of code: To stop the batch processing while running, just uncheck the option to revert to "normal mode". The conversion can be done also in "batch mode" (that is: without human intervention, converting all the pictures found in the input folder) if you check the "Batch processing" checkbox before pressing the "GO" button. Under the preview box you can find the filename and the size of the image (size on disk, dimensions X and Y, aspect ratio). In the "normal mode", when you press the "GO" button, the input folder is scanned, each single picture found is shown in the preview box and you are asked about the conversion of that specific picture. The utility I wrote is very simple: given an "input" folder, it looks for JPG pictures in that folder and - one by one - it takes them, reduces their sizes by a specified factor, and save them in a given "output" folder. I had this need of resizing pictures and - even if the world is full of image processing software capable of doing that - I decided to write my little piece of code to do it in VB.NET. You have to reduce the quality of your pictures, resampling them at a lower resolution. Often, at a good resolution, a single photo in JPG format takes more than 1 Mb, and this is not so comfortable if you want to send your pictures to your friends via email, or to put them on a web site. Normally, I prefer to take pictures using the best quality and resolution, and this - of course - implies having bigger files to manage. I came back from my holidays, with tons of photos taken with my new digital camera.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |