Resolution from Size and pixels of an image - image

Is there any formula to calculate image resolution, if provided with image size and image height and width. I googled for an answer, but didnt get much of a help. Got one formula, but if i calculate with height and width of an image, the resolution i got is different from actual resolution.
Also if i have take a pic from 42 mega Pixel camera and 32 mega pixel camera, will the image size and dimensions vary?
Thanks Jithen

It's a simple cross-multiplication
if your image is supposed to have a width of 10 inches and is 1000 pixels wide, its horizontal resolution is 1000 / 10 = 100 ppi (pixels per inch).
Do I missed something ?

Related

What is the image editor's resolution tool for?

I have an image that is 320 x 482 pixels size and 72 PPI. I can change the image resolution with GIMP for example, but why would I use it if the images suits its pixel size for each display pixel size? I mean, an image changes its size in inches depending on the display density, right? So why would I want to change the PPI of an image, that doesn't make sense to me, although I understand that GIMP and any other image editors wouldn't put this feature for nothing.
PS: I tried to change the resolution of some images and compare it with the original image and apparently nothing happened but the size in inch of the image.
An image's DPI is defined by the capturing hardware and will impact it's size when printed out.
Changing the resolution won't change the number of pixels in the image.

scale image based on resoultion (aspect ratio)

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!

Calculate DPI of image

I have an image on a canvas. That image will be resized by user.After that, the canvas content will pe printed at a specific dimension.
I want to calculate the DPI of the resized image, so i can tell the user if he resized to much and the printed quality will be affected.
Does someone know a formula for this?
DPI means dots per inch.
Divide the pixel size of the image with its physical dimensions in inches.

Image percentWidth 100 height stays original image height (margin)

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.

Open graph maximum image aspect ratio is 3:1, what about minimum?

According to the open graph documentation the maximum aspect ratio for an image is 3:1. An aspect ratio, the way I understand it, is width to height. Hence given the 3:1 requirement the width of an image can be up to 3x the height.
This however, does not seem to set any limit on the height of an image? Is there a minimum aspect requirement as well? Otherwise it would seem you could have an image for example which is 50px wide, but 500px tall?
Thanks

Resources