Resize-bitmap

May 20, 2009 at 6:12 AM

Hi,

I am interesting to resize my image files. Someone can tell me how to implement my job?

I want to search my images from A folder then reduce those images files size to B folder.

Thanks,

Coordinator
May 20, 2009 at 6:31 AM

It should work something like this:

$files = @(dir <path_to_A> *.jpg)
foreach ($file in $files) {
    $dest = Path-Join <path_to_B> $file.Name
    import-bitmap $file | resize-bitmap -percent 75 | export-bitmap -path $dest -format jpeg
}

May 20, 2009 at 10:08 AM

Hi,

I modify your script and it is working fine. Thanks a lots. ^_^

Add-PSSnapin PSCX
$files=Get-ChildItem C:\JPG *.JPG
Foreach ($file in $files) {
$dest=Join-Path C:\Temp $file.Name
$sour=Join-Path C:\JPG $file.Name
$image=(Import-Bitmap $sour | Resize-Bitmap -Percent 100)
Export-Bitmap $image $dest JPEG 50
}

 

Aug 24, 2009 at 8:40 AM
r_keith_hill wrote:

It should work something like this:

$files = @(dir <path_to_A> *.jpg)
foreach ($file in $files) {
    $dest = Path-Join <path_to_B> $file.Name
    import-bitmap $file | resize-bitmap -percent 75 | export-bitmap -path $dest -format jpeg
}

 Hi,

I have another question. Your script can process only one folder. I.E. if i want to re-size image files from A folder to B folder. And A folder includes many sub-folders. Could you modify script to fit my requirement?

If A has A1, A2, A3 so on three sub-folders. Of course there are many image files on them. I want to do a script to re-size all of A folder to B folder. When process done then B folder will include A1, A2 and A3 folder but all

image files will be resized.