aspect-ratio

How to take a photo of the same aspect ratio as in preview size?

纵然是瞬间 提交于 2020-01-01 05:28:07
问题 99.9% of all answers on a question in title are as follows: When you searching through the List<Camera.Size> , provided by Camera.Parameters#getSupportedPictureSizes() try to find the size of the same aspect ratio as the camera's preview size which you set via Camera.Parameters.html#setPreviewSize(int,int), or as close as possible. That's fine, but what if I can't find the picture size of the same aspect ratio as in preview size (Android gives you no guarantee that for every preview size

Zoom on an image on mouse move: reaching all corners

穿精又带淫゛_ 提交于 2020-01-01 03:37:10
问题 I'm working on a zoom functionality. This zoom is a fixed box with 100% of the window size and inside an image with the 200% of the width of the fixed box. This zoom needs to work like this: When the cursor is in the center of the window, the image should be in the center. When the cursor is in the top right corner, the image should stay at the top right corner of the window (so reach the image with the corner) When the cursor is in the middle bottom corner, the image should center

A simple way to put a UIImage in a UIButton

心不动则不痛 提交于 2019-12-31 09:04:12
问题 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

Make an image fit its container by setting the image height to the containers heights

£可爱£侵袭症+ 提交于 2019-12-31 00:46:09
问题 Say I have container.a and it has some height in pixels, say I have another container.b within container.a that is 80% of container.a, now say I want to fit an image that has some height in pixels into container.b, how can I make the image be the height of container.b, and then maintain the width aspect ratio using CSS? <div class="container.a"> <div class="container.b"> <img class="image.a" src="my_image.png" /> </div> </div> .container.a { width: 200px; height: 300px; } .container.b { width

preserve form's aspect ratio upon resize in c#

妖精的绣舞 提交于 2019-12-30 20:32:30
问题 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? 回答1: Some code to get you started. The key is to respond to the WM_SIZING message, it allows you to change the window

resize image canvas to maintain square aspect ratio in Python, OpenCv

笑着哭i 提交于 2019-12-30 03:22:13
问题 I'd like to get a 1000 x 1000 picture in Python from any input picture so that the input doesn't lost it's aspect ratio. With other words, I want to resize the input so that its longer dimension be 1000 pixels and "fill" the other dimension with the background color until it become 1000 x 1000 square. The original must be in the center at the end. 回答1: Using OpenCV You can use resize() in OpenCV to resize the image up/down to the size you need. However, resize() requires that you put in

WPF Resize UserControl with aspect ratio

房东的猫 提交于 2019-12-29 09:11:01
问题 I have a UserControl and that UserControl has to be resized with aspect ratio. That means: width:height = 2:1. Currently I am using this code: protected override Size ArrangeOverride(Size arrangeBounds) { if (ActualWidth == 0 || ActualHeight == 0) return arrangeBounds; base.ArrangeOverride(arrangeBounds); double ratio = 2; if (Parent != null) { var size = new Size(arrangeBounds.Height * ratio, arrangeBounds.Height); double containerWidth = ((FrameworkElement)Parent).ActualWidth; if

Pure CSS Solution - Square Elements? [duplicate]

∥☆過路亽.° 提交于 2019-12-29 04:16:25
问题 This question already has answers here : Maintain the aspect ratio of a div with CSS (23 answers) Closed 4 years ago . If I have a <div> with a relative width (such as width: 50% ), is there a simple way to make it have the same width as it does height without resorting to JavaScript? 回答1: It is actually possible to achieve it with this neat trick i found at this blog #square { width: 100%; height: 0; padding-bottom: 100%; } Hope that helps 回答2: No, and Yes (Kinda) Okay, so the short answer

How to define fixed aspect-ratio for scatter-plot

倖福魔咒の 提交于 2019-12-28 02:49:10
问题 I am plotting correlation coefficients (values = 0.0:1.0) for two isotopes measured in each individual from two populations. I would like to have a fixed aspect-ratio for my scatter-plot so that the x- and y-axis are exactly the same size no matter the graphics device. Suggestions? This is my first plot in R, any comments on refinements to my code is appreciated? Finally, is it worth investing in learning the basic plotting techniques or should I jump right to ggplot2 or lattice? My plot

Padding-bottom/top in flexbox layout

ぃ、小莉子 提交于 2019-12-27 16:50:10
问题 I have a flexbox layout containing two items. One of them uses padding-bottom : #flexBox { border: 1px solid red; width: 50%; margin: 0 auto; padding: 1em; display: flex; flex-direction: column; } #text { border: 1px solid green; padding: .5em; } #padding { margin: 1em 0; border: 1px solid blue; padding-bottom: 56.25%; /* intrinsic aspect ratio */ height: 0; } <div id='flexBox'> <div id='padding'></div> <div id='text'>Some text</div> </div> The blue element maintains its aspect ratio