Skip to content

Commit

Permalink
Small improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
PCigales authored Feb 9, 2024
1 parent e71588e commit a3c7092
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions resize.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ foreach ($p in $l) {
$n++
try {
$s = [System.IO.FileStream]::new($p, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read)
$d = [System.Windows.Media.Imaging.JpegBitmapDecoder]::new($s, [System.Windows.Media.Imaging.BitmapCreateOptions]::PreservePixelFormat, [System.Windows.Media.Imaging.BitmapCacheOption]::OnLoad)
$d = [System.Windows.Media.Imaging.JpegBitmapDecoder]::new($s, [System.Windows.Media.Imaging.BitmapCreateOptions]::None, [System.Windows.Media.Imaging.BitmapCacheOption]::OnLoad)
} catch {
$c++
Write-Host ("Traitement de " + [io.path]::GetFileName($p) + " -> ignoré (format non reconnu)")
Expand All @@ -21,7 +21,7 @@ foreach ($p in $l) {
$r = $i.Metadata.GetQuery("/app1/ifd/exif:{ushort=274}") -bor 0
$g = [System.Windows.Media.TransformGroup]::new()
$g.Children.Add([System.Windows.Media.ScaleTransform]::new($m, $m))
Switch ($r) {{3, 4 -eq $_} {$g.Children.Add([System.Windows.Media.RotateTransform]::new(180)); break} {5, 6 -eq $_} {$g.Children.Add([System.Windows.Media.RotateTransform]::new(90)); break} {7, 8 -eq $_} {$g.Children.Add([System.Windows.Media.RotateTransform]::new(270)); break}}
Switch ($r) {{$_ -in 3, 4} {$g.Children.Add([System.Windows.Media.RotateTransform]::new(180)); break} {$_ -in 5, 6} {$g.Children.Add([System.Windows.Media.RotateTransform]::new(90)); break} {$_ -in 7, 8} {$g.Children.Add([System.Windows.Media.RotateTransform]::new(270)); break}}
$t = [System.Windows.Media.Imaging.TransformedBitmap]::new($i, $g)
$f = [System.Windows.Media.Imaging.BitmapFrame]::Create($t)
$e = [System.Windows.Media.Imaging.JpegBitmapEncoder]::new()
Expand Down

0 comments on commit a3c7092

Please sign in to comment.