is now part of CreativePro.com!

Free InDesign Script to Export JPEGs or PNGs at a Precise Size

20

InDesign has had the ability since at least CS2 to export pages to JPEG. But the JPEG Export dialog box only allows you to specify a resolution value in pixels per inch. But I often find that I need a JPEG at a specific pixel dimension, such as 1000 pixels wide.

I encountered this most recently when I needed to export JPEGs from InDesign layouts for use with Behance and Adobe Portfolio. When creating images to display your projects on Behance, you should create JPEGs no more than 1400px wide, or less if you want the image to appear smaller in your project display. I tired of hauling my InDesign pages into Photoshop to create JPEGs. So I created 3 scripts that make this really easy. You can download the (free!) scripts here.

There are 3 scripts:

Export to JPG – all pages.jsx
Export to JPG – page range.jsx
Export to JPG – selection.jsx

Each script asks you where to save the exported JPG, and then presents a dialog box that is just like InDesign’s File > Export dialog, except that it has fields for entering either a width or height value in pixels.

Screen Shot 2016-04-27 at 8.57.28 AM

By the way, you may have noticed the File > Share on Behance command in recent versions of InDesign, Illustrator, and Photoshop. That command creates JPEG images for you, and uploads them automatically to Behance. But, unfortunately it uploads the images as a Behance “Work in Progress,” not a Behance “Project.” And Behance has announced that the Work in Progress feature is going to be turned off this spring.

So at this point, if you want to publish your work on Behance, you will need to create images of your work manually, and this script will be a big help!

[Editor’s note: Note that Keith also offers a similar script on his page for exporting PNG files at a specific size.]

Keith Gilbert is a design consultant, developer, educator, speaker, and author. His work has taken him throughout North America, Africa, Europe, and Asia. During his 35+ year career his clients have included Adobe, Apple, Target, Oracle, and the United Nations. He is the author of several popular titles for LinkedIn Learning, Adobe Press, and CreativePro. Find him at gilbertconsulting.com and on Twitter @gilbertconsult
  • sanjay sharma says:

    I am have downloaded the “Export to JPG” script and when I run the script in Indesign, its works fine. The only problem is there is no option for defining the resolution while exporting the images. Its always export images with 11 pixels/inch.

    • Billy Ölvestad says:

      The resolution in pixels per inch has no effect when it comes to web images. This script saves with a specific width in pixels instead, and is intended for web use.

      It is only if you need to output the files in print that you need a certain resolution in pixels per inch, and then you can use the regular export option.

      Also if someone tells you that you absolutely have to save the image in “72ppi” for web, they don´t know what they are talking about. It really has no effect at all. Only the actual size in pixels matters for web.

    • Sanjay, that is why I wrote this script! When you choose File > Export in InDesign, and choose JPEG as the format, that method allows you to specify the pixel/inch value, not a total pixel dimension value. Thinking in terms of pixels/inch is great for when that matters, such as for print output. But when creating an image for a web site or to submit to Behance or to use in an AEM Mobile browse page, you are concerned about the total dimensions, in pixels. In these situations the pixels/inch value doesn’t matter, only the total number of pixels wide or total number of pixels high. This script lets you specify those dimensions.

  • Billy Ölvestad says:

    Thank you for these scripts. I have been longing for this feature in InDesign for a long time!

    Sadly, I would have needed this script last friday, when I had to export web images from an InDesign-layout with 14 different language layers.

    What I ended up doing, as always, was exporting to 14 PDF files, open them in Photoshop, setting the exact size in the open-dialog, and the exporting for web.

    This script would have saved me some time.

    I have tried it, and it works flawlessly. Awsome!

  • Gobit says:

    Fantastic!!!! Thank you Keith.

    Cheers, Gobit

  • JRB says:

    Great job.
    Thank you.

  • Malik Aziz says:

    HALLELUJAH! Great work! Didn’t even know this is doable! I wondered why doesn’t support this since v1!

  • Rebecca Evans says:

    Thanks so much! We need to create a jpeg of every book cover using a specific pixel dimension for use on the web. This will save a lot of time.

  • David says:

    Can this be changed to exporting a Tiff file?

  • David says:

    Can this all be done in the background or would the script launch Photoshop,and process the file?

  • Keith Gilbert says:

    The script would have to launch and run Photoshop.

  • tina says:

    We’ve been using this for about 3-4 months and it’s an awesome script so THANK YOU Keith. It’s just recently started bugging out though and isn’t saving the filename anymore. I’ve tried deleting the script and uploading a new set but problem persists. Filenames are all saving as the page number from the document eg _004.jpg and ignoring the name input into save as window…. Any ideas?

  • omotta says:

    Hi. Work in InDesign CS or CS2?

    Regards.

  • Rombout Versluijs says:

    For those which need to export all linked images. Ive converted these script so it exports all linked images. It the almost 100% of the code provide by Mr. Keith. My add, what i got from a different post, i replaced the selection part.

    It run the same as the original code. Though when the dialog popsup you dont need to fill in any name, it will use the names from the linked images. Its a bit dirty coding, but i didnt found a proper method for this.

    I tried adding DPI as an input but got weird results, so i kept these width and height. Which also sometimes gives which dpi values in Photoshop i noticed. It only set the real dimension in pixels and not the document pixels i noticed. Or perhaps its not linked properly to the DPI. Cant figure it out

    Anyways, here’s the link to the 2 files. https://www.dropbox.com/s/2tqxh6nhf6dza6w/Export-linked-JPG-PNG.zip?dl=0

    • Rombout Versluijs says:

      I did some small edits, i had forgot 1 tiny part. It was exporting the images in the ratio as they are placed. I added a code hint so you can easily adjust the files. Now it export the image in the original ratio

  • Rombout Versluijs says:

    I did some small edits, i had forgot 1 tiny part. It was exporting the images in the ratio as they are placed. I added a code hint so you can easily adjust the files. Now it export the image in the original ratio

  • >