google-code-export / zscreen

Automatically exported from code.google.com/p/zscreen
1 stars 0 forks source link

Auto scale, shrink, don't grow #440

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What new or enhanced feature are you proposing?

Auto scaling with fixed size selection under image options by setting a zero 
value in either width or height (see attached screenshot).

What goal would this enhancement help you achieve?

Ability to capture screenshots that fit a max width.  Currently I am building 
documentation where image size should not exceed 600px.  ZScreen is unable to 
do this without stretching or squashing.

The attached patch will also cater for auto scaling height, though this would 
probably be used less often.

Original issue reported on code.google.com by ebsw...@gmail.com on 28 May 2011 at 3:06

Attachments:

GoogleCodeExporter commented 9 years ago
I messed up the patch I attached previously; this one should be pretty close.

Original comment by ebsw...@gmail.com on 28 May 2011 at 4:28

Attachments:

GoogleCodeExporter commented 9 years ago
Hi thanks for patch. I tried to apply patch but TortoiseSVN gave error about 
wrong lines. So i will add it manually.

I noticed problem in here:
imgWidth = Convert.ToInt16((Convert.ToDouble(img.Height) / 
Convert.ToDouble(img.Width)) * Engine.conf.ImageSizeFixedHeight);

I think it must be (width / height) * fixedHeight ?

Current codes:
http://dl.dropbox.com/u/14076298/ZScreen/2011-05/2011.05.28-08.34.05.txt

case ImageSizeType.FIXED:
   img = GraphicsMgr.ChangeImageSize(img, Engine.conf.ImageSizeFixedWidth, Engine.conf.ImageSizeFixedHeight, true, true);

I committed codes you can test it:
http://code.google.com/p/zscreen/source/detail?r=2209

Original comment by flexy...@gmail.com on 28 May 2011 at 5:37

GoogleCodeExporter commented 9 years ago
Yikes, you're right, glad you picked that up.  Nice neat implementation of the 
changes, and quick!  Good to see the idea was accepted.

A quick test shows it works, though I haven't tried zero height yet.  I was 
initially tricked up by the folder location changing to AppData/Roaming.

The only thing I'd suggest is something that tells the user they can set auto 
scaling by using a zero width OR height in the radio button text itself - 
similar to what I had in my screenshot.

Original comment by ebsw...@gmail.com on 28 May 2011 at 6:31

GoogleCodeExporter commented 9 years ago
I found an issue during testing with images that are smaller than the given 
width - it messes up the height.  I've built a patch off what you changed - do 
I need to create a new issue?  I've attached a fix for this.

Original comment by ebsw...@gmail.com on 28 May 2011 at 7:15

Attachments:

GoogleCodeExporter commented 9 years ago
I thought this is same thing as your code:

            if (preserveSize)
            {
                imageWidth = Math.Min(img.Width, width);
                imageHeight = Math.Min(img.Height, height);
            }

Your code:

                if (width > img.Width || height > img.Height)
                {
                    imageWidth = img.Width;
                    imageHeight = img.Height;
                }

Original comment by flexy...@gmail.com on 28 May 2011 at 5:08

GoogleCodeExporter commented 9 years ago
It almost does the same thing, except that the height will be stretched if the 
width is less than the given fixed width.  For example, if fixed size is given 
as:

w: 600 h:0

If the input image is 300x200, then width will be set to 300, height will be 
set to 0, and height will be further processed to scale and it gets stretched.

My code says that if the height or the width comes out smaller than the fixed 
size, then don't resize.  This works for me for all size images - I still 
haven't tested for height though.

Original comment by ebsw...@gmail.com on 28 May 2011 at 7:18

GoogleCodeExporter commented 9 years ago
The above should have read *if the height or width comes out larger than the 
fixed size...

Original comment by ebsw...@gmail.com on 28 May 2011 at 7:59

GoogleCodeExporter commented 9 years ago
I applied your patch thanks.
http://code.google.com/p/zscreen/source/detail?r=2213

Original comment by flexy...@gmail.com on 28 May 2011 at 8:50

GoogleCodeExporter commented 9 years ago
ebswift what you think about this new resize interface: 
http://dl.dropbox.com/u/14076298/ZUploader/2012/01/12_21-27-29_jPhleZ.png
is it better than current settings?

Original comment by flexy...@gmail.com on 12 Jan 2012 at 8:03