aspect-ratio

CSS resizable images with header

风流意气都作罢 提交于 2019-12-13 17:09:20
问题 I'm trying to get an HTML layout of two images that are shown side-by-side, and fill the page while maintaining their aspect ratio and keeping the images next to each other (i.e. NOT in the centre of each half of the page). I also want a header at the top. I have almost achieved this using the CSS hackery below. Currently it looks like this: If I shrink it horizontally the images shrink as expected (note SO has fit the images to width but the "Choose an image." text size is constant in

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

﹥>﹥吖頭↗ 提交于 2019-12-13 12:18:49
问题 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

Resizing a rectangle and snapping to a fixed ratio

不羁岁月 提交于 2019-12-13 06:23:49
问题 I currently have code which resizes a rectangle based on mouse movement when the user clicks on multiple anchors which correspond to the following areas: Left, Top, Right, Bottom, TopLeft, TopRight, BottomLeft, BottomRight. So the user can click and drag the top anchor and it will adjust the Top coordinate of the rectangle based on where the mouse is. Same for all the other anchors. After the fact I want to enforce a fixed ratio (such as 2:3 or 5:7) by snapping the appropriate sides of the

Pyplot imshow not showing square pixels when setting aspect ratio

ε祈祈猫儿з 提交于 2019-12-13 03:21:50
问题 I am having some trouble using Pyplot imshow to plot an image from a numpy ndarray called data keeping both its aspect ratio and square-shaped pixels. The shape of the ndarray is (112, 2182) . Here´s the code I´m using: import matplotlib as mpl from mpl_toolkits.axes_grid1 import make_axes_locatable import numpy as np mpl.use('Agg') import matplotlib.pyplot as plt data = np.random.random_sample((112, 2182)) plt.figure(figsize=(25, 3.5)) plt.subplots_adjust(left=0.1, right=0.9) ax = plt

Resizing image in VBA maintaining aspect ratio

拈花ヽ惹草 提交于 2019-12-13 03:07:03
问题 I have a VBA macro that goes for an image in a file and sticks it into an Excel spreadsheet, in a worksheet called "Country Profile". I would like to resize the image so that it has a width of 350px, while maintaining its aspect ratio. This is the code that I wrote: Public Sub Macro15() Dim picname As String Dim shp As Shape Dim present As String Sheets("Country Profile").Activate Sheets("Country Profile").Select ActiveSheet.Pictures.Delete Cells(19, 40).Select 'This is where picture will be

Camera PreviewView is stretched in some Android devices

断了今生、忘了曾经 提交于 2019-12-12 12:43:03
问题 I'm playing with the API2 Camera of Google and I'm having some problems with my code. I had two different CameraSessions, one for video and another one for images. To do it more efficient I change the code to use a unique Session and make the app more efficient. After I did this, my camera preview is not working adequately. When I'm using a 4:3 aspect ratio my preview become stretched at height. In other way it looks fine when I'm using 16:9 ratio. In both cases my pictures looks fine, I mean

How to stop window size jumping around when forcing fixed aspect ratio?

夙愿已清 提交于 2019-12-12 10:14:43
问题 Here's my test code: import QtQuick 2.4 import QtQuick.Window 2.2 Window { visible: true readonly property int defaultWidth: 700 readonly property int defaultHeight: 500 width: defaultWidth height: defaultHeight readonly property real aspectRatio: defaultWidth / defaultHeight readonly property real scaleFactor: width / defaultWidth onWidthChanged: { var properHeight = Math.round(width / aspectRatio); if ( height !== properHeight ) { height = properHeight } } onHeightChanged: { var properWidth

Change tiff pixel aspect ratio to square

China☆狼群 提交于 2019-12-12 09:10:24
问题 I'm trying to perform barcode recognition on a multipage tiff file. But the tiff file is coming to me from a fax server (which I don't have control over) that saves the tiff with a non-square pixel aspect ratio. This is causing the image to be badly squashed due to the aspect ratio. I need to convert the tiff to a square pixel aspect ratio, but have no idea how to do that in C#. I'll also need to stretch the image so that changing the aspect ratio still makes the image legible. Has anyone

Show correct aspect ratio

这一生的挚爱 提交于 2019-12-12 04:36:08
问题 I am trying to get the aspect ratio of a photo but the following code shows wrong aspect ratio on a photo with 3776 in width and 2520 in height (472:315) but it shows correct aspect ratio on a photo with 3968 in width and 2232 in height though (16:9). function gcd($a, $b) { if($a == 0 || $b == 0) { return abs(max(abs($a), abs($b))); } $r = $a % $b; return ($r != 0) ? gcd($b, $r) : abs($b); } $gcd = gcd($widtho, $heighto); echo ($widtho / $gcd).':'.($heighto / $gcd); How can I solve my problem

FFmpeg Slideshow + Audio + Watermark + Maintain Aspect Ratio

对着背影说爱祢 提交于 2019-12-12 04:16:44
问题 I'm trying to make a slideshow from some pictures along with an existing mp3 (copied). Picture dimensions differ, but I want the video output to be 16:9 aspect ratio and 3840x2160. I also want a watermark. It is important that pictures are not stretched. I tried this code... ffmpeg -y -framerate 1/1.5 -i "pics/%03d.jpg" -i audio.mp3 -c:v libx264 -r 24 -preset veryfast -tune stillimage -c:a copy -pix_fmt yuv420p -aspect 16:9 -filter_complex "scale=iw*min(3840/iw\,2160/ih):ih*min(3840/iw\,2160