Skip to content
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

Update Aspect Ratio Calculation on Images #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SathinduGA
Copy link

I have updated the aspect ratio calculation method from

ar = page.getWidth() / image.getWidth();

to

float i_width = image.getWidth();
float i_height = image.getHeight();

if(i_width > i_height){
    ar = page.getWidth() / i_width;
 }else {
    ar = page.getHeight() / i_height;
}

because if image height is greater than the width the updated method gives correct aspect ratio. Otherwise previous aspect ratio will give the value to fit in to width in every scenarios.

@HendrixString
Copy link
Owner

Thanks
I will go over this the next couple of days

@vladimirarevshatyan
Copy link

This has to be merged!

@HendrixString
Copy link
Owner

@vladimirarevshatyan have you tested it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants