Thanks for coming to InDesignSecrets.com, the world's #1 resource for all things InDesign!

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.

Exporting to JPEG or PNG from InDesign only allows you to specify the resolution of the exported image, not the pixel dimensions.

Exporting to JPEG or PNG from InDesign only allows you to specify the resolution of the exported image, not the pixel dimensions.

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.

The ?W? or Width field in the control panel displays the current width of the selected objects.

The ?W? or Width field in the control panel displays the current width of the selected objects.

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.

Let InDesign do the Math for you!

Let InDesign do the Math for you!

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.

Tags
Related Articles
Comments

14 Comments on “How to export the selection to a precise size

  1. Thanks for the script! We’re doing more and more work for digital displays. This will really help save some time.

  2. Guys, I am just throwing this question out there. Can Incopy cs6 open Indesign CC files? Obviously I am in a panic.

  3. Hi Lenny. Better place for this question would be our forums, but the answer is no. InCopy has never been able to open later-version InDesign files, and this is true for CS6 InCopy/CC InDesign too.

    You need to think of them as a matched set; or think of InCopy as a version-specific plug-in.

    The good news is that CC includes one install of InCopy; and your editors should be able to subscribe just to InCopy (rather than the whole CC) which will be a lot less $$.

    • Hi Anne. Thank you for the information…it does offer some hope.

      Trying to get adjusted to the new workflow, infinite rentals, till death do us part.
      Sorry again for the post but I was panic stricken wondering what to do after I upgrade to CC versions.

  4. “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.”
    Can you explain why this works? Is 72 ppi hardcoded as a default translation between pixels and inches in InDesign?

  5. @Shmuel: Yes, a “pixel” in InDesign is hard coded to be the same as a “point” which is 1/72 of an inch.

    Actually, you can change the points/inch value in the Units & Increments pane of the Preferences dialog box, but the range is only 60 to 80. But even if you do that, pixels still appears to remain at 72 ppi.

  6. Having trouble with this. Doing the math is cool, but it only “matches” the width. If I need to export a graphic to a precise size, like a standard ad size, it’s likely my ID artwork will be too short or too tall, wouldn’t it? Then I’d have to go back to InDesign and edit it, then rexport with the math. (possible to edit in Photoshop of course but if I need to recenter text on a background image or anything like that, quite difficult with a flattened JPEG or PNG.)

    Isn’t it easier to scale the selection in InDesign to the correct width, edit for height, then export the selection at 72ppi?

    • @Anne-Marie, yes, the best way is just to create the ID file to size, as mentioned in the third para. But I’ve had a few clients that need to quickly extract photos from a print layout to “fit” within a box of a certain width or height for a Web CMS, and this provides a quick way to do so. Often in these cases they just need the image to fit within a certain width, and the height is unimportant, or vice-versa.

  7. Ah … yes, I’ve had that situation of an image needing to fit that way. Hmm.

    I would still just enter the desired width or height in the appropriate Scale field, myself. Hit return and you’ve got it sized, then export at 72. The math method does save an Undo step though. ;-D Plus, it’s math. Neat.

  8. Thanks for this script. I found the resolution of the exported PNG varies if we input different pixel width. Is that correct?
    If I need 72 ppi and specified pixel width/height of PNG then I copied that artwork in another document and scale it there and then export at 72 ppi.
    Virender

  9. I’m working with InDesign CS6 and have 3 layouts set up (desktop, tablet, mobile) in one document. I have all my document presets set to web, made sure that my rulers and guides are all set to pixels, and have set the image sizes on each layout to the exact pixel height/width that I need. When I export to HTML, I select 72 ppi — yet the images that are exported are completely the wrong sizes. For example, my desktop image should be 1500px x 1331px, but it’s exporting out to only 610px x 542px. I’m at a complete loss, and have a massive project deadline soon. Any thoughts or advice on this would be greatly appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>