How to export the selection to a precise size
InDesign allows you to export your selection to JPEG format, or in CS6, PNG format. When you choose File > Export to do this, you will see the dialog box pictured below. Notice that it allows you to specify the resolution of the export as a pixel per inch value.
Thinking in terms of pixels per inch is useful for creating an image that will be printed. But exporting to JPEG or PNG directly from InDesign can be really useful for creating Web content such as banner ads, or icons, splash pages, and other elements needed for Digital Publishing Suite projects. In these cases, you usually want to output your selected objects to a certain pixel dimension. For example, you may need to create a 512 pixel x 512 pixel PNG icon for an iPad app, or a JPEG banner ad that is 250 pixels wide, or an image for your Web CMS that is no wider than 400 pixels.
There are two ways to do this directly from InDesign. The best way is to create your artwork to the exact pixel dimensions in InDesign (using either pixel or points measurement units), and then export the artwork at a resolution of 72 pixels per inch. In other words, if you create artwork that is 200 by 150 pixels, and export it at 72 pixels per inch, the final pixel dimensions of the PNG or JPEG you export will be 200 x 150 pixels.
But what if you’ve already created the artwork, and need to export to a different size, or perhaps export the same artwork in multiple sizes? This requires some simple math, and I’ll even show you how to make InDesign do the calculations for you!
All you do is divide the desired output width or height by the existing width or height, and multiply the result by 72. Here’s an example:
Lets say we have content that we’ve created that is 176 pixels wide. We need to output this to JPEG format 400 pixels wide. We can verify the width of the artwork by selecting it and viewing the ‘W’ field in the Control panel at the top of the screen. For this to accurately reflect the width of objects with strokes, be sure that “Dimensions Include Stroke Weight” is selected in the Control panel menu.
Next, choose File > Export, and select JPEG for the format. Choose ‘Selection’ for the Export type, and then in the Resolution field, enter ’400/176*72′. As soon as you tab or click away from this field, InDesign will do the math and enter 164 as the result. Now, when you click Export, a JPEG image the desired size will be output.
One caveat: Due to rounding, sometimes the JPEG or PNG image that is output is off by a few pixels in size. In this example, 400/172*2 = 163.636364, which InDesign rounds up to 164 pixels, resulting in a JPEG image that is 401 pixels wide.
To make this even simpler, I’ve written a free script called “Export PNG with dimensions” available here, that prompts you for the desired width or height, does the math for you, and exports to PNG format.