mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Fixed the bug reported here: https://sourceforge.net/projects/greenshot/forums/forum/676082/topic/6510105/index/page/1
The resizing didn't work, after the resizing was fixed the OCR didn't work and I had to change to resize the canvas... now it seems to be working again. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2410 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
c352c4061b
commit
42011d2588
2 changed files with 21 additions and 3 deletions
|
@ -147,8 +147,16 @@ namespace GreenshotOCR {
|
|||
|
||||
// Also we need to check the size, resize if needed to 130x130 this is the minimum
|
||||
if (surface.Image.Width < MIN_WIDTH || surface.Image.Height < MIN_HEIGHT) {
|
||||
IEffect resizeEffect = new ResizeEffect(Math.Max(surface.Image.Width, MIN_WIDTH), Math.Max(surface.Image.Height, MIN_HEIGHT), true);
|
||||
outputSettings.Effects.Add(resizeEffect);
|
||||
int addedWidth = MIN_WIDTH - surface.Image.Width;
|
||||
if (addedWidth < 0) {
|
||||
addedWidth = 0;
|
||||
}
|
||||
int addedHeight = MIN_HEIGHT - surface.Image.Height;
|
||||
if (addedHeight < 0) {
|
||||
addedHeight = 0;
|
||||
}
|
||||
IEffect effect = new ResizeCanvasEffect(addedWidth / 2, addedWidth / 2, addedHeight / 2, addedHeight / 2);
|
||||
outputSettings.Effects.Add(effect);
|
||||
}
|
||||
filePath = ImageOutput.SaveToTmpFile(surface, outputSettings, null);
|
||||
|
||||
|
|
|
@ -1321,7 +1321,17 @@ namespace GreenshotPlugin.Core {
|
|||
nPercentW = ((float)newWidth / (float)sourceImage.Width);
|
||||
nPercentH = ((float)newHeight / (float)sourceImage.Height);
|
||||
if (maintainAspectRatio) {
|
||||
if (nPercentH != 0 && nPercentH < nPercentW) {
|
||||
if (nPercentW == 1) {
|
||||
nPercentW = nPercentH;
|
||||
if (canvasUseNewSize) {
|
||||
destX = Math.Max(0, System.Convert.ToInt32((newWidth - (sourceImage.Width * nPercentW)) / 2));
|
||||
}
|
||||
} else if (nPercentH == 1) {
|
||||
nPercentH = nPercentW;
|
||||
if (canvasUseNewSize) {
|
||||
destY = Math.Max(0, System.Convert.ToInt32((newHeight - (sourceImage.Height * nPercentH)) / 2));
|
||||
}
|
||||
} else if (nPercentH != 0 && nPercentH < nPercentW) {
|
||||
nPercentW = nPercentH;
|
||||
if (canvasUseNewSize) {
|
||||
destX = Math.Max(0, System.Convert.ToInt32((newWidth - (sourceImage.Width * nPercentW)) / 2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue