# Pixels in Vectors - SVG

I am working on the svg-edit application and I am receiving customer orders through the web.

I am converting those pixels to mm based on the formula `3.77 pixels = 1 mm`.

Is there anyway that something might go wrong if my customer uses a different PPI than what I am using or maybe a different monitor or operating system or maybe a monitor?

If a user draws a shape on my online editor using a different PPI than I do is there any possibility that I will get a different pixel shape?

Is there any possibility that my formula might have to change if my customer is using a different PPI, monitor or operating system or even browser than I do?

-
This is quite difficult to answer. But if your editor works in absolute pixels and you are making the end user aware of what the consistent scale factor, you are probably OK. But where did you get 3.77 pixels = 1mm from and how do you tell the user how big in mm the end result will be (e.g. are they working within an fixed pixel area which represents an A4 sheet?) –  e100 Dec 4 '12 at 18:22
i have no idea what an absolute pixel is actually the title might be wrong. i found the formula on google actually. What i do is i let the user draw the shapes using the pixel measurements but i tell him that it is millimiters. The user has no idea that he is drawing in pixels. I just make the conversion by importing in Corel Draw x4 and scaling the object by 377.9 % . Does pixel size vary in size in SVG between browsers or DPI settings? –  Nicholas Kyriakides Dec 4 '12 at 19:00
The user is able to preload the editor with a fixed canvas size.. either its 500 * 500 pixels or 300* 300 pixels. However the word pixel is not used, i tell them it is millimiters and when i get their submitted design i just use the formula to do the conversion in Corel Draw. In Corel Draw when the submitted drawing is imported and i use 96DPI as a resolution i always get the size of their objects 377.9% smaller. Therefore i use the formula to get the same size in millimiters. I am a bit confused with the DPI in corel draw because i though vectors had no DPI. –  Nicholas Kyriakides Dec 4 '12 at 19:11
raster images have the resolution (number of pixels [the dots in DPI]) fixed at creation time, where PURE vector images have their resolution undefined until they are rendered to an output device (printer or screen). I say "pure" because one can have raster texture fills etc. embedded within the vector art. The vector will remain scalable, but the raster portions will degrade in quality if scaled significantly from their creation size. –  horatio Dec 4 '12 at 20:22
If you have ever had to manually graph a solution in algebra or calculus by hand with pen and paper, you probably did so with fewer points than you would if you had a graphing calculator. This is, in a simplistic way what vector images are doing: with pen and paper, you had a very low-dpi renderer and the calculator was a higher dpi, but in both cases the "image of the graph" was stored as a function. –  horatio Dec 4 '12 at 20:26

It is plausible (without getting into a discussion of whether it is likely) that an end user is viewing the application with some equipment or setup that alters the aspect ratio of the display.

In this scenario, what they see as a square would appear to you on the server end as a rectangle.

One simple way to guard against this is to show a square and inform the user that if it does not look like a square to them, then there is a problem.

Regarding actual size in real-world units, you would show a scale of some sort which they can use to scale or zoom the application and hold a ruler up to the screen.

Both of these would be simple ways to calibrate the client display.

-
Actually my user draws in pixels but i tell him that this is millimiters. The user has no idea it is pixels i just make the conversion in corel draw by scaling the object by 377.9% and it works. Does pixel size vary in size in SVG between browsers or DPI settings? I am not too worried about shapes actually i typed in the wrong word. what i actually meant was size. Is there any possibility that i get on my side a different pixel number for width and height between browsers or DPI settings between users? –  Nicholas Kyriakides Dec 4 '12 at 19:02
Although I can't really get my head around converting pixels to millimeters, does the formula mm=(pixels×25.4) ÷ dpi found at www.dallinjones.com/2008/07/how-to-convert-from-pixels-to-millimeters/ help anything? @horatio or anyone: please, could you elaborate on the underlying issues/principles for non-experts, too? Surely this is about differences for output on screen versus output on printing/plotting devices? –  TehMacDawg Dec 4 '12 at 19:14
I dont know if i got the right answer by my own but i dont think that any DPI settings will really affect my drawing since my clients send to me their objects in vectors. I think vectors are DPI independent so their pixels are pretty much a number that i get to this size. Its when i do the conversion on my side that i have to worry about DPI. Actually the DPI i have set in Corel Draw where i do the conversion. So yeah TehMacDawgs formula is correct i think. –  Nicholas Kyriakides Dec 4 '12 at 19:21
Pure vector images are UNIT independent which is deeper than "DPI independent." You ask whether DPI varies on the client side, but ask yourself: is a 1280x720 pixel image the same physical size on a 50 inch monitor and a 20 inch monitor? –  horatio Dec 4 '12 at 20:13
@TehMacDawg: DPI is a derived measurement which requires dots AND inches to calculate. Raster images deal in dots (pixels) only. Pixels are basically a logical unit immutable in size (think of the classical atom). The exact same 100px square image WITHOUT editing or altering the image file can be printed at .33 inches (300 dpi) or 100 inches (1 dpi) –  horatio Dec 4 '12 at 20:17

You may or may not have a problem.

You say:

The user is able to preload the editor with a fixed canvas size.. either its 500 * 500 pixels or 300* 300 pixels ... my user draws in pixels but i tell him that this is millimiters. The user has no idea it is pixels

If you make the user aware that the canvas area on the screen represents a printable area of 80 mm square or 133 mm square (using your existing 3.77 px per mm = 96 px per inch (ppi) conversion factor) then that should be OK.

(I have to say, I think you may have started by looking at the wrong end of the problem. Are your print sizes actually intended to be 80 mm square or 133 mm square?)

One way of doing this by showing rulers with mm units around the canvas, as Horatio suggests. Although you don't necessarily need to be explicit, e.g. if your application was for printing on CDs and your canvas showed the outline of a CD it would be obvious.

But if you are relying on the canvas on the screen being true to print size, i.e. actually measuring 80 mm square or 133 mm square on the user's screen, you have a problem, as this will only be be true for monitors which display at 96 ppi, and where there is no additional scaling in the browser or OS.

Desktop and laptop screens commonly have a a ppi value between about 80 and 130, and much higher for some mobile devices, so there will be a great deal of difference.

-
I was actually suggesting something a lot simpler: "this is a square, if it does not look square on your monitor, you have a problem!" :) –  horatio Dec 5 '12 at 15:12