I was working with a lot of images for a website today and I needed to quickly create thumbnails for each one. I did a quick Google search on PowerShell and creating thumbnails, but I gave up after about a minute… yeah, I probably got impatient, but oh well.
Anyway, here it is:
get-childitem *.jpg | foreach { $full = [System.Drawing.Image]::FromFile("$(resolve-path $_)"); $thumb = $full.GetThumbnailImage(72, 72, $null, [intptr]::Zero); $thumb.Save("$(resolve-path $_).thumb.jpg" ); $full.Dispose(); $thumb.Dispose(); }
Obviously, you likely wouldn’t hardcode the height and width for the thumbnail, but would probably base it off of the original image (i.e. varying it off of whether the image was wide or tall). But, I didn’t need to. That’s up to you to figure out
Remember Me
a@href@title, b, blockquote@cite, i, u
Page rendered at Tuesday, December 02, 2008 7:20:27 AM (Central Standard Time, UTC-06:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.