aspect-ratio

How to “smart resize” a displayed image to original aspect ratio

一世执手 提交于 2019-12-03 06:08:07
问题 I have an application in which end-users can size and position images in a designer. Since the spec calls for the image to be "stretched" to the containing control, the end user can end up with an awkwardly stretched image. To help the user with image sizing I am thinking of implementing a smart resizer function which would allow the the user to easily fix the aspect ratio of the picture so that it no longer appears stretched. The quick way to solve this is to actually provide two options: 1)

FFmpeg - Change resolution of the video with aspect ratio

感情迁移 提交于 2019-12-03 02:40:03
all. How to change resolution of the video with aspect ratio with FFmpeg? There are options http://manpages.ubuntu.com/manpages/oneiric/man1/ffmpeg.1.html -s size Set frame size. The format is wxh (ffserver default = 160x128, ffmpeg default = same as source). The following abbreviations are recognized: and -aspect aspect Set the video display aspect ratio specified by aspect. aspect can be a floating point number string, or a string of the form num:den, where num and den are the numerator and denominator of the aspect ratio. For example "4:3", "16:9", "1.3333", and "1.7777" are valid argument

ConstraintLayout aspect ratio

徘徊边缘 提交于 2019-12-03 02:09:55
问题 Consider the following layout file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.constraint.ConstraintLayout android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:background="

ImageMagick: how to minimally crop an image to a certain aspect ratio?

女生的网名这么多〃 提交于 2019-12-03 01:28:37
With imagemagick, I'd like to crop an image, in a minimal fashion, so that it fits a given aspect ratio. Example: given an image of, say, 3038 x 2014 px, I want to crop it to have a 3:2 aspect ratio. The resulting image would then be 3021 x 2014 px, cropped from the, say, center of the original image. So looking for a command looking something like convert in.jpg -gravity center -crop_to_aspect_ratio 3:2 out.jpg . 1. Specific target resolution If your goal at the end is to have a certain resolution (for example 1920x1080) then it's easy, using -geometry , the circumflex/hat/roof/house symbol (

PHP fit any size image to 16:9 aspect ratio

本小妞迷上赌 提交于 2019-12-02 23:26:11
问题 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. 回答1: 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

Maintaining aspect ratio with min/max height/width?

馋奶兔 提交于 2019-12-02 22:27:09
I have a gallery on my site where users can upload images. I would like the images to sit in a div that maintains its height, the images should be no larger than 500px in height. The width should be automatic to maintain aspect ratio. HTML: <div id="gallery"> <img src="uploads/my-dynamic-img.jpg"> </div> I've tried this CSS: #gallery{ height: 500px; img{ max-height: 500px; max-width: 100%; } } The above works well, the gallery is always 500px high and images never exceed 500px in height. I run into problems though with smaller images, if a user uploads a really small image, I would like it

A simple way to put a UIImage in a UIButton

℡╲_俬逩灬. 提交于 2019-12-02 19:35:56
I have a UIButton in my iPhone app. I set its size to 100x100. I have an image that is 400x200 that I wish to display in the button. The button STILL needs to stay at 100x100... and I want the image to downsize to fit... but keep the correct aspect ratio. I thought that's what "Aspect Fit" was used for. Do I include my image with setImage, or setBackgroundImage? Do I set AspectFit for the button? or the image? or the background image? (I need the smaller images to INCREASE in size. While larger images should DESCREASE in size. Always keeping the button at 100x100.) I've tried countless

How to “smart resize” a displayed image to original aspect ratio

旧时模样 提交于 2019-12-02 19:35:42
I have an application in which end-users can size and position images in a designer. Since the spec calls for the image to be "stretched" to the containing control, the end user can end up with an awkwardly stretched image. To help the user with image sizing I am thinking of implementing a smart resizer function which would allow the the user to easily fix the aspect ratio of the picture so that it no longer appears stretched. The quick way to solve this is to actually provide two options: 1) scale from width 2) scale from height. The user chooses the method and the algorithm adjusts the size

ConstraintLayout aspect ratio

喜欢而已 提交于 2019-12-02 17:15:07
Consider the following layout file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.constraint.ConstraintLayout android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FF0000" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity

Strategies for Handling Multiple Screen Resolutions and Aspect Ratios in Web Development

只愿长相守 提交于 2019-12-02 14:28:08
Back in the day, 800 x 600 was the screen resolution to design for - and maybe 640 x 480. Then along came 1024 x 768, etc, etc, etc. But then it gets worse: now we have not only different resolutions but also different aspect ratios. What strategies do people use to accommodate today's ever-expanding range of screen sizes and aspect ratios? (BTW - I was only thinking about laptop / desktop hardware, but of course there's smart-phones and tablets to consider too.) I know this would be a somewhat controversial opinion, but I'd say it anyway: Don't Don't design for multiple screen sizes or aspect