A rather basic maths problem.
I got an image with a specific width and height in pixels:
WIDTH = 3648 px
HEIGHT = 2736 px
In order to compute the target print size in millimeters, given a specific DPI amount (200) i came up with this:
PRINT-WIDTH = IMAGE-WIDTH-PX / 200 * 2.54 * 10;
PRINT-HEIGHT = IMAGE-HEIGHT-PX / 200 * 2.54 * 10;
This works well. In our example it computes
463 x 347 mm
as target print size. Perfect.
However, i now must be able to make changes to the widths and heights in millimeters, and based on the fact that we assume 200 DPI for printing, i must compute the new DPI value.
So for instance, when changing 463 x 347 to 400 x 300 i should somehow be able to calculate how that affects the DPI.
The only possible approach that came to my mind was to compute the difference between the old and the new format as a percentage, and then apply that percentage to the DPI. But the results are incorrect.
How can i compute the DPI value from the new width and height, given the original 200 DPI matching the original format?
NewDPI = 200 * 463 / 400
Or without using DPI 200 at all:
NeededDPI = IMAGE-WIDTH-PX(3648) * 25.4 / PRINT-WIDTH(400)
Related
I'm trying to use mm in CSS as opposed to the standard px.
first is this even possible?
if so, can i use it like this:
#div{
width:200mm;
height:100mm;
}
I did try to convert the millimeters to pixels so I can use the pixels value but every converter returns a different value which is strange. even Photoshop converts it and gives me a different value.
Could someone please advise on this issue?
The CSS Values and Units Module Level 3 defines the mm unit as 1/10th of 1cm. It also defines the cm unit as 96px/2.54.
In CSS, 200mm and 100mm are always equal to the same px value:
For 200mm:
cm = (200mm / 10)
px = cm * (96 / 2.54)
-> 755.91px
For 100mm:
cm = (100mm / 10)
px = cm * (96 / 2.54)
-> 377.95px
(Note that these values are rounded).
24 bits RGB color model with 2048 pixels in width and 1536 pixels in
height has a total of 3.1 megapixels is correct if that so how to get this answer. I am totally new to multimedia section
Total Pixels = [Pixel width * Pixel height * color depth * #frames per seconds]
= [2048 * 1536 * (24/8)]/1024 * 1024
= 9 Megapixel
I have a resizable window, and a graph which consists of 11 lines of different values ranging from 0 to 1000. What is the math I would use to compute this?
I want to have the data ranging from 0 to 1000 be so that it equals 0-1000 pixels on screen. But if I resize my window to say 640 / 480, the graph will adjust only will be less detailed.
This is a simple proportion: if 640 pixels bar represents value of 1000, value of Y will represent 640 * Y / 1000 pixels bar.
You did not specify a programming language.
In HTML you can size anything as %, so you calculate size as % of maximum - i.e. 550 (out of 1000 max) = 55%
If you use % size it will automatically adjust with screen/window size.
If you specify your programming language of choice we may be able to help you more
Sorry for asking this question, I didn't pay attention in school...
Say I have two numbers: 3 and 7
I'd like to create a bar that shows the percentage of both numbers (out of 100%)
in other words, calculate those numbers, so the bar shows:
IIIXXXXXXX
I hope I make sense.. thanks in advance.
I think you mean you want a bar to display 3 and 7 as relative values, each taking up an appropriate percentage of the whole
IIIXXXXXXX
The calculation is simple:
var total = 3 + 7;
var percentA = 3 / total; // 30%
var percentB = 7 / total; // 70%
The width of each component is the total bar width multiplied by the selected value and divided by the sum of values.
So if the bar should be, say, 100px, you would calculate the width of the two components like
var widthA = 100 * ( A / (A+B) );
var widthB = 100 * ( B / (A+B) );
or 100 * ( 3 / (3+7) ) => 100 * (3/10) => 30, and 70.
If your asking for a physical representation of the numbers percentage out of 100 I would start by getting the percent:
int number = 3; //or 7
int percent = number/100;
Then I would have a sprite 1 pixel big and scale it based on percent, for example:
mybarsprite.scale = percent*100;
Then you could add a background image to create the bar and have that be 100 pixels. Add both sprites at the same position, the background sprite at a lower z level add you have a bar affect.
Here's one way (taken from a progress bar plugin):
This is JavaScript, but the language is of course irrelevant.
var max = 250; // the total amount representing 100%
var current = $obj.val().length; // the length we are measuring
// important: current / max * 100
// use min() to ensure that the result isn't greater than 100 due to rounding
var ratio = Math.min( ( ( current / max ) * 100 ), 100 );
The key piece is dividing the current amount by the total amount, where the total amount (whatever it may be) represents 100%. That division operation should yield a value less than 1. To convert that to a 1-100 percentage, multiply by 100.
In my above example, if current = 125, and max = 250, then we have 125 / 250 = 0.5. Multiplying 0.5 * 100 gives 50. 125 is 50% of 250.
If you wanted to get both percentages, you could simply subtract the first result from 100.
Here is a complete working example of a HTML/CSS/jQuery progress bar for managing the maxlength of a textbox: http://jsfiddle.net/QfZPt/1/
I have two different resolutions, the original one is 567x756 (wXh), the one which I want to display is 768x1024 (wXh). How to find out the scaling ratio for these two resolutions? For example if the font size used in 567x756 resolution is 7 pts then what's the values I should multiply with the font size (7 pts) to display the text in 768x1024 resolution.
Whenever you hear "scaling", think "proportions":
You can set up a proportion, here:
old width new width
--------- = --------
old font new font
567 768
---- = -----
7 x
567*x = 5376
x = 9.48
So your new font is about 9.48, or 9 if you only want integers.
Alternatively, you could also use the height-to-height proportion in your calculations instead of width-to-width. Or use the average font height you'd get from doing either. Or do old_area/old_font^2 = new_area/new_font^2
If you want a way to find the scaling factor for any arbitrary new width:
old width new width
--------- = --------
old font new font
567 w
---- = ---
7 x
567*x = 7*w
x = (7/567) * w
Given your new w (or h, or w/e), the new font size is (7/567) * w
The aspect ratios are the same for both resolutions, so just take one dimension and use that as your scaling ratio, i.e.
1024/756
Which is about 1.35. Or if you want to scale in the other direction, 0.738