Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenXML distance, size units

What are the measurement units used to specify sizes or X,Y cordinates in OpenXML? (Presentation).

Does it makes sense to match those with pixels, if so how can be those converted to pixels?

graphicFrame.Transform = new Transform(new Offset() { X = 1650609L, Y = 4343400L }, new Extents { Cx = 6096000L, Cy = 741680L });

In above code X is set to 1650609 units? What units are they?

like image 606
BuddhiP Avatar asked Nov 25 '13 13:11

BuddhiP


2 Answers

They are called EMU (English Metric Units)

http://en.wikipedia.org/wiki/English_Metric_Unit#DrawingML

http://polymathprogrammer.com/2009/10/22/english-metric-units-and-open-xml/

1pt = 12,700 EMU

Also as explained here 1px =~ 9525EMU

http://openxmldeveloper.org/discussions/formats/f/15/p/396/933.aspx

like image 104
BuddhiP Avatar answered Oct 18 '22 19:10

BuddhiP


EMU is right, although converting EMU to PX depends on the image density. The conversion factor for 96ppi images is 9525, while for a 72ppi image is 12700 and for a 300ppi image is 3048.

So, the conversion factor would be emu's per inch (914,400) / image ppi.

Example: a 200px width image with a density of 300ppi, would give us 609,600 EMU:

609,600 EMU / (914,400 emus-per-inch / 300 pixels-per-inch) = 200 px
like image 1
julifos Avatar answered Oct 18 '22 18:10

julifos