Skip to content

Instantly share code, notes, and snippets.

@rafatux
Last active October 30, 2019 15:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafatux/61fd665fc455e54d69ae14f2cf6e1d58 to your computer and use it in GitHub Desktop.
Save rafatux/61fd665fc455e54d69ae14f2cf6e1d58 to your computer and use it in GitHub Desktop.
Redimensiona un conjunto de jgp de una carpeta a otra a un tamaño especificado en vb.net
Imports System
Imports System.Drawing
Module Program
Sub Main(args As String())
Dim sourcePath As String = args(0)
Dim outputPath As String = args(1)
IO.Directory.CreateDirectory(outputPath)
Dim dir = New IO.DirectoryInfo(sourcePath)
Dim files As IO.FileInfo() = dir.GetFiles("*.jpg", IO.SearchOption.AllDirectories)
For Each fInfo In files
Console.WriteLine("Procesando archivo" & fInfo.FullName)
Using img As Bitmap = Image.FromFile(fInfo.FullName)
Using resizedImg As New Bitmap(img, args(2), args(3))
resizedImg.Save(IO.Path.Combine(outputPath, fInfo.Name),
Imaging.ImageFormat.Jpeg)
End Using
End Using
Next
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment