FAQ Database Discussion Community

## How can I find the ratio between two file sizes as a percentage in Python?

python,math,percentage,filesize,ratio
I've written a short Python script to find the original and minified sizes of a script, by comparing file sizes, and to find the difference and compression ratio. The script itself follows: #! /usr/bin/python import os import sys file1 = sys.argv[1] file2 = sys.argv[2] file1Size = os.stat(file1).st_size file2Size = os.stat(file2).st_size...

## Fixed thumbnail ratio size & maintaining aspect ratio?

html,css,thumbnails,aspect-ratio,ratio
There are some questions that are properly similar, but i can't relate it to my specific situation. I have created a responsive thumbnail grid with 4-to-3-to-2 columns structure (in percentages 25%-33,33%-50%). I'm using a fake placeholder image of 500x330px for testing, but i would like to have a fixed thumbnail...

## Scale divs height pure CSS

html,css,css3,scale,ratio
I need to scale the height of divs. How it should work The divs should scale, keep current aspect ratio The width should be 100px always The height should scale in propotion to the 100px width I added some example width and height in the code Add more HTML +...

## Swift/Xcode: position a button in ratio to to view or a view element

swift,layout,ratio
As it can be seen on the picture I've got a button in foreground and a fish as image in the background. The button should always be at the same position on the fish no matter which device is used. So I can't use normal Space Constraints because the image...

## Work out the dimensions of a room based on a ratio in Excel from a total area [closed]

excel,area,dimensions,ratio
I am trying to work out the dimensions of a room to the ratio 3:2 from only knowing the total area. For example, if I have a room of area 10M^2 I want to know the 2 lengths that make up that area to the ratio of 3:2. I have...

## PHP fit any size image to 16:9 aspect ratio

php,resize,crop,ratio,aspect
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....

## Scale div so that it always keeps its aspect ratio and stays centered

css,html5,image,css3,ratio
My english is not good, so i can't explain well enough, but here is an example In the example if you resize window, background image of div.main always will be sized in accordance with its ratio (1280*752). It would be perfect if i knew how to make div be resizing...