Skip to content
Advertisement

Convert Google slides EMU units to pixels – API

I am using Google API to get cropping, dimensions, and scaling information for the pictures which are present in a given google slide presentation. This information I intend to port and use in publishing these slides as webpages (HTML) or port the same content to Google docs (as the case may be).

The problem that I am facing is I am not clear how the EMU units map to pixels.

Based on trial and error calculation 9525 EMU seems to be 1 pixel.

But when I refer to

Interestingly the factor is 2.54 which is how many centimeters an inch is.

I think I can manage with the 9525 conversion factor, but it doesn’t make sense, and I want to be sure I am on the right track. Does anybody have some clarity on this?

Advertisement

Answer

As per documentation:

An English Metric Unit (EMU) is defined as 1/360,000 of a centimeter and thus there are 914,400 EMUs per inch, and 12,700 EMUs per point.

I’m guessing that they used the same units as CSS. In that case, you can find on the official specification that 1 inch is equivalent to 96 pixels:

The reference pixel is the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm’s length. For a nominal arm’s length of 28 inches, the visual angle is therefore about 0.0213 degrees. For reading at arm’s length, 1px thus corresponds to about 0.26 mm (1/96 inch).

From there the math is simple:

914,400 / 96 = 9525

Which is what you found experimentally.

References

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement