Free InDesign Script to Export JPEGs or PNGs at a Precise Size
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.
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.]
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.
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.
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!
Thanks for the feedback, Billy. Glad to hear that someone else has a need for this sort of thing!
Fantastic!!!! Thank you Keith.
Cheers, Gobit
Great job.
Thank you.
HALLELUJAH! Great work! Didn’t even know this is doable! I wondered why doesn’t support this since v1!
Thanks Keith!
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.
Can this be changed to exporting a Tiff file?
Sorry, David. InDesign doesn’t offer TIFF export. You could vote for it as a new feature here: https://indesign.uservoice.com/forums/601021-adobe-indesign-feature-requests/suggestions/31242415-export-as-tiff
David, Mike is right. Just to clarify…Scripts can only automate what can already be done manually in InDesign. Since InDesign can’t export an image as a TIF, neither can a script. That said, it would be possible to create a script that grabs and image from InDesign, opens it in Photoshop, and exports it from Photoshop as a TIF at a certain size. But that’s a whole ‘nuther script…it wouldn’t be a small modification to this one.
Can this all be done in the background or would the script launch Photoshop,and process the file?
The script would have to launch and run Photoshop.
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?
Hi. Work in InDesign CS or CS2?
Regards.
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
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
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