Home > Back-end >  A picture zoom title, is now seems to be wrong
A picture zoom title, is now seems to be wrong

Time:10-14

1. There is a figure (any) wide, in the position of the plane x=0, y=0 img. H w img.
2. There is a framework (any) wide, in the position of the plane x=0, y=0 box. H w box.
Question: can only change pictures wide or high (but not affect the image of the original aspect ratio), make the final image width is equal to the width of framework or higher framework of images of high (the modified image width or height not less than the width of the framework, or high)

I'm a little stupid, a description of the math is bad, so the prawns, please do me a favor,

CodePudding user response:

Figure of wide use img. W said figure high with img. H
Framework for the wide use of box w. presentation framework with high box. H
The calculation formulas, please. Thank you.

CodePudding user response:

Image scaling value with nearest neighbor method, this method is the most simple! Check your online a lot of ah!

CodePudding user response:

The last to come,
A=img. W/img. H the scale of this is the picture

Img. W=box. W
Img. H=img. W/A
Here are judgment
If img. H & lt; Box. H then begin
? Img. H=box. H
Img. W=img. H * A
end;

CodePudding user response:



On the left side of the two attributes is done,

CodePudding user response:

Find a good image processing code, dare not exclusive,,,

http://www.cnblogs.com/Thinknet/articles/392834.html
  • Related