I am confused in deciding the dimensions for a background image for my website. I am creating a collage like image in picasa and it defines the image dimensions using aspect ratios. If I want to create an image of 2048 x 1800, what aspect ratio should I use?
Wolfram Alpha gives the exact result 256/225, so an aspect ratio of 256:225 is correct. (Of course, a more inexact value would be 1.14:1, which would give you something like 2052x1800.)
As the aspect ratio is the ratio of the width of the image to its height, the aspect ratio of 2048x1800 image is 1.14:1 (2048/1800 = 1.14).
Related
I'm not sure how to ask this question in words without it becoming very confusing. So I'll provide point form data to try and relay my issue.
I've taken screenshots of the same image at different screen resolutions.
This results in the image having different widths & heights.
[]
img1.png
resolution = 1024×768
aspect ratio = 4:3
image = 43x43 pixels
img2.png
resolution = 1280×1024
aspect ratio = 5:4
image = 57x57 pixels
img3.png
resolution = 1920×1080
aspect ratio = 19:9
image = 60x60 pixels
img4.png
resolution = 3440x1440
aspect ratio = 21:9
image = 80x80 pixels
[]
we are given ONLY one of these four images
we also have a different resolution then this image
now find image = ??x?? pixels
[]
For sake of argument we have img3.png. Then change our resolution to 1280x1024. From here I can't figured out how to resize img3.png so that it knows it need to scale down to 57x57 instead of 60x60
i could hard code
4:3 = 0.716
5:4 = 0.95
21:9 = 1.33
then i could use 60*0.95 = 57
but i'm stubborn and want to be able to do this dynamically
[]
the reason behind this is so i can do an image search on different resolutions
I assume the same square image is displayed on different screen resolutions, and based on some logic, it is shown a little bigger or smaller. Now your problem is, what's that logic?
Since it is always square, so it is not related to the aspect ratio. Then I guess the logic is trying to fit a square area, probably holding multiple of your small square image, to the rectangular screen. Since all these screens are landscape, then I would like to test the heights of each screen:
768:1024:1080:1440 = 0.533:0.711:0.75:1,
43:57:60:80 = 0.537:0.712:0.75:1
Got it? It's just scaled proportional to the height of the screen!
My actual Image is
Here I need to resize the image 140*80(Width*height)
But after resize the circle in the image becomes oval how to prevent that.
Your current image resolution is 700*312 has a ratio of 1:2.2435897435897435897435897435897..
The resolution you are trying to get is 140*80 has a ratio of 1:1.75.
In order to get a perfect circle, you must maintain the same ratio between the images.
If acceptable, try resizing your image to 140*62.4 (62.4 = 140/(700/312)).
More info about Aspect Ratio on Wikipedia .
Specifically for Xamarin, please show us what components are you using, or some example code so answers could be more specific.
I have an image I use as overlay in a vector layer in my openlayer web application. The idea is the same as showed in this example
What I do not understand is how to set a valid resolution to my image so that every time the user changes the zoom of the map, the image width and height is adjusted to cover its real geographical area.
In the example above some images are used and placed at some specific locations using a specific and hard-coded resolution factor.
Assume I have an image 400x400 pixel which represents an area of 400x400 kilometers, I need to recalculate the width and height of my image every time the zoom factor changes using a formula like this:
imageWidth = imageWidthInPixel * theResolution / map.getResolution();
imageHeight = imageHeightInPixel * theResolution / map.getResolution();
where 'theResolution' is the value I need to calculate some way I don't know. I guess this is a value that depends on the area expressed in kilometers or meters the image covers, but I am not able to find out a relation that has a sense. As explained above, in the example I reported, these values are hard-coded and depends on the image but there is no way to understand how these values are calculated.
Please help me understand this.
If you know the projection of your image, it would be easiest to simply define the image as a layer defined in OpenLayers with the appropriate projection. At that point, OpenLayers will handle the zooming and panning for you.
What happens with the code below is that image width is scaled to 100% as expected and the height also scales as expected keeping the aspect ratio correct. Issue is that there is a margin at the bottom and that seems to be the height of the original contentHeight of the image. How can I get rid of that?
I am using percentages so that it scales when device orientation changes.
backdrop.source = "http://cf2.imgobject.com/t/p/" + "w342" + data.backdrop;
backdrop.scaleMode = "letterbox";
backdrop.horizontalAlign = "left";
backdrop.verticalAlign = "top";
backdrop.smooth = true;
backdrop.percentWidth = 100;
The answer to your question is don't use the letterbox setting. That is going to preserve the aspect ratio and make the black area, hence the name letterbox :)
Try setting scaleMode to zoom instead. As the documentation states, zoom will result in one axis being clipped. This should scale the image, preserve the aspect ratio, but clip some edges of the image to avoid having the black area.
Other solutions to this problem are:
modify the original image outside of Flash
use a mask to achieve similar results that the zoom setting will provide. In this approach you make the image bigger, but then apply a square mask to the image. The mask reveals only the square portion ... clipping what is outside the mask.
(undesirable in most cases) use the scaleMode setting of strectch (and specify both width/height) so that the area is filled, this will not preserve the aspect ratio
PS: There is no way to avoid the black area if the image's aspect ratio is not square. Even with HTML/CSS. This is just math/geometry. The same thing happens in HTML -- the image is either stretched, clipped, or will not fill both dimensions.
[Edit]
PPS: One other idea, if you know the original aspect ratio of the image, is to calculate a new width that will be closest to the desired width, but naturally preserves the width to height aspect ratio.
For example, the width:height ratio is 4:3. Your desired width is 500 pixels. Using cross products you get this:
4 500
- = -
3 x
Using cross products you get the equation:
4x = 3*500
Now solve for x:
x = 3*500/4 = 375
Therefore, if the original aspect ratio is 4:3, you can set a width of 500 and a height of 375 to scale the image and not have any black areas. You can even write code that dynamically calculates the aspect ratio, and applies this logic to scale something nicely. The point is that you have to the respect aspect ratio when scaling the image to avoid the "black" areas.
I have to scale down image of any dimension to a fixed dimension of 135x135, most imp thing I have to maintain good quality of scaled down image. I'm not much familiar with Image Processing algos. Can you guys suggest me any algorithm.
Unless the input image is square, say 1000x1000, you will first have to crop it to a square aspect ratio (1:1) then scale it down to 135x135 pixels.
Firstly answer if you want to crop the image or deforming the image to fit in the box
Apply a 2d Sinc filter with the right size for the current scale factor.
Scan the new image and pick up pixels from the old one by just dividing.