Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Pixel-accurate drawing in PowerPoint; measuring in pixels

Problem

You plan to export a PowerPoint slide at a specific resolution (number of pixels) and want to be able to enter sizes and positions IN pixels as you create your drawing, but PowerPoint only accepts inches, points, cm, mm, etc as dimensions.

Or you know that you'll be displaying your presentation on a monitor or projector of a certain size (in pixels) and want to be able to work in pixel units instead of inches or points or centimeters.

Solutions

In more recent versions of PowerPoint, you can now enter pixels as units of measurement. In any text box that allows you to enter a measurement, enter, for example, 96pixel, 96pix or even 96px. PowerPoint will convert that to inches or cm (depending on your Windows measurement settings) at 96 dpi, usually. This may or may not produce the result you're after. If not, read on.

Another approach is to set your page size up correctly before starting to draw. If you need to export images, use a little VBA code (or the PPTools ImageExport add-in).

For example, to create a 500 pixel by 100 pixel banner:

Here's the code to export the currently selected slide to an image. Don't be startled if the text looks like the dog chewed on the edges. PowerPoint exports ugly text. ImageExport exports pretty text. You get to choose. Nice.

Sub ExportAnImage()

    Dim sExportFile As String
    Dim sExportType As String
    Dim lheight As Long
    Dim lwidth As Long

    ' EDIT THESE LINES:
    sExportFile = "C:\Temp\PixelAccurate.PNG"
    sExportType = "PNG"
    ' make sure that width/height is proportional to slide width/height
    lwidth = 500
    lheight = 375
    ' DON'T CHANGE ANYTHING ELSE

    With ActiveWindow.Selection.SlideRange(1)
        .Export FileName:=sExportFile, filtername:=sExportType, _
            Scalewidth:=lwidth, Scaleheight:=lheight
    End With

End Sub

See How do I use VBA code in PowerPoint? to learn how to use this example code.

Background

This all came up in one of the sessions at PowerPoint Live 2009 when Ellen Finkelstein asked why we couldn't use Pixels as a unit of measurement in PowerPoint instead of the usual inches, cm, points etc.

For most uses of PowerPoint, this doesn't make a lot of sense because PowerPoint sizes its output to match the current printer or monitor, however many pixels that'll take. Since you can't know ahead of time how large the output will be, you can't specify in advance how large to make any one shape.

But once Ellen explained that she was creating web graphics and knew in advance that she'd export her slides to a certain size, THEN we had a problem we could solve.


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Pixel-accurate drawing in PowerPoint; measuring in pixels
http://www.pptfaq.com/FAQ01028_Pixel-accurate_drawing_in_PowerPoint-_measuring_in_pixels.htm
Last update 19 September, 2014
Created: