aspect-ratio

Image plot in bokeh with tight axes and matching aspect ratio

怎甘沉沦 提交于 2019-12-05 05:59:02
I'm using bokeh 1.0.1 version inside a Django application and I would like to display microscopic surface images as zoomable image plots with a color-encoded height and colorbar. In principle this works, but I have problems to get plots with the correct aspect ratio only showing the image without space around. Here is an example for what I want to achieve: The resulting plot should show an image of random data having a width of sx=10 and a height of sy=5 in data space (image size ) have axes limited to (0,sx) and (0,sy) , on initial view and when zooming a square on the screen should match a

Flexbox, responsive grid of square divs maintaining aspect ratio

北战南征 提交于 2019-12-05 05:08:36
I'm trying to create a 2x2 grid with divs. Some of the divs might contain an image, but it will probably be set as a background, with the option background-size: cover . Here's the pen I created: http://codepen.io/qarlo/pen/vLEprq .container { display: flex; flex-wrap: wrap; justify-content: space-between; margin: auto; max-width: 960px; width: 80%; } .container__item { align-content: center; border: 1px solid #333; display: flex; flex-basis: 1; font-size: 3em; justify-content: center; height: 100%; margin-bottom: 1em; min-height: 300px; width: 47%; } <div class="container"> <div class=

Android camera - Preview size, Picture Size, cropping and distortions

穿精又带淫゛_ 提交于 2019-12-04 19:33:30
My application needs to capture some pictures of a given size (lets say WxH) in a portrait orientation mode. In a general case the size WxH I want is not supported by the camera therefore I will need to crop the captured picture in order to match my specifications. This apparently simple program is driving me crazy for the problem of "good" corrispondence among preview and picture sizes and format. Let me explain: I need a format (let's give some numbers: 800x600) for the output image, and I have to take pictures in a portrait screen orientation. My camera by default is in Landscape mode

Image Resizing in (PHP/GD)

馋奶兔 提交于 2019-12-04 19:19:33
I'm looking for help/suggestions in finding the most efficient way to resize an image to be as small as possible using PHP/GD while preserving the aspect ratio of the original image but ensuring the the resized image is bigger than a defined minimum width & height. For example, the resized image must have a width >= 400 and a height >= 300 but should be as close to those dimensions as possible while maintaining the original aspect ratio. Such that a "landscape" image would have an ideal height of 300 or slightly larger with a width >= 400 and a "portrait" image would have an ideal width of 400

How to keep the aspect ratio of a UserControl?

馋奶兔 提交于 2019-12-04 16:09:54
Does anyone have an idea how to keep the Height/Width Ratio 1:1 of a UserControl? E.g. if Height > Width, Width & Height will have the same size and vice versa. I'm not sure this will work, but if you register a handler for the SizeChanged event and in there put in your code keep the aspect ratio 1:1. The SizeChangedEventArgs argument has the old size and the new size so you can check which has changed and update the other accordingly. You might need to introduce a guard variable so that you don't get a cascade of SizeChanged events as a result of updating the Height or Width . Another

Resize UILabel correct on top of UIImageView

纵饮孤独 提交于 2019-12-04 16:09:09
My problem is as follows: I have on top of a UIImageView some labels. The image is a formular and the UILabel s represents the entries. If I rotate the device the image inside UIImageView gets resized with option "aspect fit". How can I achieve that the UILabel is also resized and aligned correct? The normal options for resizing aren't working as needed. The UIImageView is zoomable with minimumZoomScale and maximumZoomScale set. Thanks. You can resize a UILabel proportionally using: label.transform = CGAffineTransformMakeScale(0.5, 0.5); You can reposition a UILabel relatively using: label

How to show the same part of game on every aspect ratio on Android devices with Unity?

寵の児 提交于 2019-12-04 09:15:01
I'm coming from Libgdx engine to Unity and I'm a beginner programmer. I try to make a game in Unity for Android and iOS devices, but I have a problem with the aspect ratio/resolution scaling. In Libgdx if you have develop something you give a "default" resolution, and everything will be scaled to the device's screen, not matter if it has bigger or smaller resolution, and nothing will be cut off from the screen. On the other side, in Unity if I make a game it will crop the screen to the chosen aspect ratio, which is not the best if you want the same experience across all the devices available.

Image size calculation by keeping aspect ratio with different screen resolutions

允我心安 提交于 2019-12-04 08:07:32
I am trying to resize an image by keeping the aspect ratio. It should be just large enough to fill the screen with no blank space and if necessary some of the image should be off-screen. The image below shows how the yellow image should be sized based on the black screen size. Heres the Code that I am actually using, is there any better way to do this? if(bwidth > bheight) { if(bwidth > swidth && bheight > sheight) { new_height = sheight; new_width = (int) ((double) (bwidth/100)*(sheight/((double) (bheight)/100))); } else if(bwidth > swidth && bheight < sheight) { new_height = sheight; new

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

会有一股神秘感。 提交于 2019-12-04 07:35:31
问题 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.) 回答1: I know this would be a

Resizing N # of squares to be as big as possible while still fitting into box of X by Y dimensions. (Thumbnails!)

核能气质少年 提交于 2019-12-04 07:34:15
I have N squares. I have a Rectangular box. I want all the squares to fit in the box. I want the squares to be as large as possible. How do I calculate the largest size for the squares such that they all fit in the box? This is for thumbnails in a thumbnail gallery. int function thumbnailSize( iItems, // The number of items to fit. iWidth, // The width of the container. iHeight, // The height of the container. iMin // The smallest an item can be. ) { // if there are no items we don't care how big they are! if (iItems = 0) return 0; // Max size is whichever dimension is smaller, height or width