-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Limits resize enhancement #529
Comments
Didn't get it, is it not work the same now? |
The orientation of the limit box is fixed, but I hope it will can rotate automatically. Then I don't have to resize separately for the pictures in different directions. |
Hm, can you explain it using abstract numbers and inequalities please?👀 |
the following powershell script did what I wanted. [void] [System.Reflection.Assembly]::LoadWithPartialName('System.Drawing')
[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
$image = [System.Drawing.Image]::FromFile($imageFilePath)
$imageAspectRatio = $image.Width / $image.Height
$_limitWidth = $limitWidth
$_limitHeight = $limitHeight
if ($imageAspectRatio -ge 1.0)
{
# Set limit box as landscape
$limitWidth = ($_limitWidth, $_limitHeight | Measure-Object -Maximum).Maximum
$limitHeight = ($_limitWidth, $_limitHeight | Measure-Object -Minimum).Minimum
}
else
{
# Set limit box as portrait
$limitWidth = ($_limitWidth, $_limitHeight | Measure-Object -Minimum).Minimum
$limitHeight = ($_limitWidth, $_limitHeight | Measure-Object -Maximum).Maximum
}
$limitBoxAspectRatio = $limitWidth / $limitHeight
$isOverTheLimit = ($image.Width -gt $limitWidth) -or ($image.Height -gt $limitHeight)
if ($isOverTheLimit)
{
# Limits resize
if ($imageAspectRatio -ge $limitBoxAspectRatio)
{
# Resize by width and keep the ratio
$scaleWidth = $limitWidth
$scaleHeight = ($limitWidth / $imageAspectRatio) -as [int]
}
else
{
# Resize by Height and keep the ratio
$scaleWidth = ($limitHeight * $imageAspectRatio) -as [int]
$scaleHeight = $limitHeight
}
}
else
{
# Keep original size
$scaleWidth = $image.Width
$scaleHeight = $image.Height
} |
thanks 👀 |
Another problem, no save button in the latest version. |
Where? |
You need to select preset or limit box to appear |
i see, thanks. both width and height must be set. i originally thought that it will use the maximum value depending on the image format. |
An option to rotate the limit box depending on original image orientation.
For example the both side lengths of the limit box are 3840 and 2560 then
resize below 3840x2560 for the landscape images
4000x3000 -> 3414x2560
4000x2250 -> 3840x2160
1920x1440 -> 1920x1440
1920x1080 -> 1920x1080
...
and resize below 2560x3840 for the portrait images
3000x4000 -> 2560x3414
2250x4000 -> 2160x3840
1440x1920 -> 1440x1920
1080x1920 -> 1080x1920
...
The text was updated successfully, but these errors were encountered: