aspect-ratio

Maintain aspect ratio with a fixed height

吃可爱长大的小学妹 提交于 2019-12-02 14:11:47
问题 So I want to maintain a specific aspect ratio of a div , where the height is fixed. In the past I have done this, but only when using a fixed width like this: .one-one { position: relative; } .one-one:before { display: block; content: " "; width: 100%; padding-top: 56.25%; /* Ratio of 16:9 (16w:9h) * (h / w) * 100 = % * (9 / 16) * 100 = % * 0.5625 * 100 = 56.25% * 1:1 = 100% */ } So that's how I would do it using a fixed width of 100% in this example. However, this time I want to make an

PHP fit any size image to 16:9 aspect ratio

好久不见. 提交于 2019-12-02 13:30:28
Good noon, I'm currently trying to understand how i can crop image already loaded on server with 16:9 aspect ratio. For better understandig, if I have 4:3 image i have to cut top and bottom image portions to fit it into 16:9 ratio. Thanks. I took this code example: http://myrusakov.ru/php-crop-image.html and changed the code according to my needs in this way: function crop_image($image) { //$x_o и $y_o - Output image top left angle coordinates on input image //$w_o и h_o - Width and height of output image list($w_i, $h_i, $type) = getimagesize($image); // Return the size and image type (number

Maintain the aspect ratio of an image?

女生的网名这么多〃 提交于 2019-12-02 07:58:57
问题 I am using pictureBox to show images which are received from server but my problem is that picture box in compact framework has only three Size Modes StretchImage, Normal, CenterImage the pictures i am getting are generally bigger in size so i have to use StrecthImage mode. But then the aspect ratio is maintained so the images shown become distorted. So is their anyway to come out of this problem ? 回答1: finally i found answer for my question which is here----- float actualHeight = myImg

Maintain aspect ratio with a fixed height

戏子无情 提交于 2019-12-02 07:25:32
So I want to maintain a specific aspect ratio of a div , where the height is fixed. In the past I have done this, but only when using a fixed width like this: .one-one { position: relative; } .one-one:before { display: block; content: " "; width: 100%; padding-top: 56.25%; /* Ratio of 16:9 (16w:9h) * (h / w) * 100 = % * (9 / 16) * 100 = % * 0.5625 * 100 = 56.25% * 1:1 = 100% */ } So that's how I would do it using a fixed width of 100% in this example. However, this time I want to make an iPhone mockup where there is a fixed height of 100% and the ratio is 4:7 (4w:7h). Using a fixed height, I

Libgdx camera/scaling issue

穿精又带淫゛_ 提交于 2019-12-02 06:07:14
This is just a really quick post wondering what i have done wrong? I want the background to be filled on the whole screen with whatever screen sizes i have but this does not make it work. Here is all the code: // Variables Jump game; OrthographicCamera cam; SpriteBatch sb; // Variables public SplashScreen(Jump game) { this.game = game; cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.translate(cam.viewportWidth / 2, cam.viewportHeight / 2); sb = new SpriteBatch(); } public void show() { } public void render(float delta) { Gdx.gl20.glClearColor(0.2F, 0.6F, 1F

Maintain the aspect ratio of an image?

喜夏-厌秋 提交于 2019-12-02 05:47:39
I am using pictureBox to show images which are received from server but my problem is that picture box in compact framework has only three Size Modes StretchImage, Normal, CenterImage the pictures i am getting are generally bigger in size so i have to use StrecthImage mode. But then the aspect ratio is maintained so the images shown become distorted. So is their anyway to come out of this problem ? finally i found answer for my question which is here----- float actualHeight = myImg.Height; float actualWidth = myImg.Width; float imgRatio = actualWidth / actualHeight; float maxRatio = (float

How to fit image to frame keeping aspect ratio and center in thumbnail list

妖精的绣舞 提交于 2019-12-01 21:21:17
问题 I want to show list thumbnail box as data grid. each thumbnail image has to be placed in frame with specific width and height (for consistency) as follow: <div class='frame'> <img src='img1.jpg' /> </div> <div class='frame'> <img src='img2.jpg' /> </div> By setting image width and height to frame, images change to wrong aspect ratio and for smaller size image than frame, they are stretched to frame (I don't want to effect smaller size image). How can I fit image within frame without effecting

How to fit image to frame keeping aspect ratio and center in thumbnail list

我与影子孤独终老i 提交于 2019-12-01 19:49:06
I want to show list thumbnail box as data grid. each thumbnail image has to be placed in frame with specific width and height (for consistency) as follow: <div class='frame'> <img src='img1.jpg' /> </div> <div class='frame'> <img src='img2.jpg' /> </div> By setting image width and height to frame, images change to wrong aspect ratio and for smaller size image than frame, they are stretched to frame (I don't want to effect smaller size image). How can I fit image within frame without effecting aspect ratio of image. my next question is how can I set image to center of frame whatever the size is

preserve form's aspect ratio upon resize in c#

元气小坏坏 提交于 2019-12-01 19:35:46
How can I make a form have a fixed aspect ratio that is preserved when it is resized? I know it can be done by overriding OnSizeChanged and manually modifying the [new] Height/Width, but that causes flicker since it is resized once before the event is called (to a size not matching the aspect ratio) and then resized again (to the correct aspect ratio). Is there a better way? Some code to get you started. The key is to respond to the WM_SIZING message, it allows you to change the window rectangle. This sample is crude, you really want to pay attention to which corner or edge is being dragged by

16:9 aspect ratio with fixed width

北城余情 提交于 2019-12-01 15:56:06
If I were to embed a YouTube video for example <iframe width="560" src="http://www.youtube.com/embed/25LBTSUEU0A" class="player" frameborder="0" allowfullscreen></iframe> Using jQuery would I set a height with an aspect ration of 16:9 so if the width is 560 the height should be 315px. I have this jquery to set a height but I dont know how to apply the 16:9 ratio $('.player').parent().attr('width', ':9ratio'); or can this be done neatly using css? mrtsherman Aspect ratio is just width:height. So if you wanted to calculate the height based on a known width it is pretty straightforward. //width