aspect-ratio

How to calculate Android screen aspect ratio mathematically

久未见 提交于 2019-12-04 01:48:38
One of the device screen properties that Android lets an app query is it's aspect ratio. In the examples that I have seen this property seems to have only two values - long and notlong . I am trying to reverse engineer the logic being used by Android to classify a device as having one of the two aspect ratios. To get some official data to work with, I referred to the values provided by the device definitions included in the AVD Manager tool in Android Studio, and combined that with my own calculations: The column "Published Ratio" shows the value extracted from the AVD Manager. Based on these

Nexus 4 Camera preview aspect Ratio always requires 16x9 surfaceview? Why

百般思念 提交于 2019-12-03 23:59:38
Device Nexus 4 Android ver: 4.2.2 Hoping someone else has found this and can explain how to resolve it.... Nexus 4 supports the following preview sizes: - W:1280 H:720 Ratio: 1.777777 W:800 H:480 Ratio: 1.6666666 W:768 H:432 Ratio: 1.7777778 W:720 H:480 Ratio: 1.5 W:640 H:480 Ratio: 1.3333334 W:576 H:432 Ratio: 1.3333334 W:480 H:320 Ratio: 1.5 W:384 H:288 Ratio: 1.3333334 W:352 H:288 Ratio: 1.2222222 W:320 H:240 Ratio: 1.3333334 W:240 H:160 Ratio: 1.5 W:176 H:144 Ratio: 1.2222222 myCamera.setPreviewSize() sets them, and when I call myCamera.getPreviewSize() I get the correct one that I set,

Aspect Ratio Stretching in OpenGL

假装没事ソ 提交于 2019-12-03 20:27:57
问题 I am having some trouble with full screen mode. I can set my window to be 800x600, but when I full screen that resolution, it stretches. I assume this is because of a change in aspect ratio. How can I fix this? Edit #1 Here's a screen shot of what I see happening. Left: 800x600 Right: 1366x768 Edit #2 My initGraphics function gets called every time I re-size the window (WM_SIZE). void initGraphics(int width, int height) { float aspect = (float)width / (float)height; glViewport(0, 0, width,

How to have a circular, center-cropped imageView, without creating a new bitmap?

空扰寡人 提交于 2019-12-03 19:11:39
问题 Note : I know there are a lot of questions and repositories about this, but none seems to fit what I try to achieve. Background Given a bitmap of any aspect-ratio, I wish to set it as the content of an ImageView (using a drawable only, without extending the ImageView), so that the content will be center-cropped, and yet in the shape of a circle. All of this, with minimal memory usage, because the images could be quite large sometimes. I do not want to create a whole new Bitmap just for this.

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

[亡魂溺海] 提交于 2019-12-03 14:20:29
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 supported by the camera there is a picture size of the same aspect ratio), and all other picture sizes

ImageMagick change aspect ratio without scaling the image

房东的猫 提交于 2019-12-03 12:59:34
I have a large number of images that can be any dimension that I need make into the same aspect ratio (basically square). So if one image is 100x300 the output should be 300x300. What I don't want is the image scaled or stretched in any way. I just want a background color (white) applied to the sides of the image, then the original image centered (either vertically or horizontally depending on the original aspect ratio). I've played around with a couple different convert commands, but I have not found the magic one yet - they all either distort the image to reach the aspect ratio, or scale the

FFmpeg - Change resolution of the video with aspect ratio

霸气de小男生 提交于 2019-12-03 12:18:45
问题 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

Zoom on an image on mouse move: reaching all corners

我们两清 提交于 2019-12-03 08:48:28
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 horizontally and reach the total bottom, so we can see the middle bottom part of the image. And so on. I make an

Maintaining aspect ratio with min/max height/width?

限于喜欢 提交于 2019-12-03 08:35:50
问题 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

Corona SDK Cross Device Screen Resolution

我怕爱的太早我们不能终老 提交于 2019-12-03 07:28:28
问题 This is going to be one of those awkward questions looking for an answer that probably doesn't exist, but here goes. I've been developing some simple games using Corona and whilst the functionality seems to work pretty well across most of the physical devices I have tested on, the one main issue is the layout. I know you can't really build for every single device perfectly, but I'm wondering if there is a common method to make an app look good across as many screens as possible. I have access