Android-PdfMyXml icon indicating copy to clipboard operation
Android-PdfMyXml copied to clipboard

Update Aspect Ratio Calculation on Images

Open sathinduga opened this issue 6 years ago • 3 comments

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.

sathinduga avatar May 23 '18 10:05 sathinduga

Thanks I will go over this the next couple of days

HendrixString avatar Jun 01 '18 22:06 HendrixString

This has to be merged!

vladimirarevshatyan avatar Jun 25 '19 10:06 vladimirarevshatyan

@vladimirarevshatyan have you tested it ?

HendrixString avatar Jun 25 '19 10:06 HendrixString