Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

export 'book' to jpg files

Contributor ,
Apr 18, 2010 Apr 18, 2010

I've put together an indesign book of several indd files. I can only export the entire book to pdf. What I would like is to be able to export the book as jpg files. One for each page of the book.

But perhaps there's also a script available to have indesign look into a folder and export all indd files into jpg files? Now I would have to open each indd file, export it to jpg (selecting 'all pages' and a resolution), close it, open the next indd file etc.

TOPICS
Scripting
5.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 18, 2010 Apr 18, 2010

Sure. Quick, dirty, but it appears to work. (I'll not ask *why* you are exporting a perfectly good InDesign document to JPEG; I'm sure you are well aware of its limitations. It has been discussed over and over in the General ID forum, but if you are hearing this for the first time, post a question in there and await the reactions.)

Copy, paste into a plain text editor (Notepad, TextEdit (in plain text mode!), or InDesign's own ESTK) and save as "ExportBookToJpeg.jsx" into your Scripts folder. Adjust the export parameters at the top to your settings, then run the script.

app.jpegExportPreferences.exportingSpread = false;

app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.EXPORT_ALL;

app.jpegExportPreferences.jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING;

app.jpegExportPreferences.resolution = 150;

if (app.books.length != 1)

     alert ("This only works when you have one (1) book open");

else

     for (b=0; b<app.books[0].bookContents.length; b++)

     {

          c = app.open(app.books[0].bookContents.fullName);

          c.exportFile (ExportFormat.JPG, File(app.books[0].bookContents.fullName+".jpg"));

     }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 19, 2010 Apr 19, 2010

That seems to do it 😉

One more thing: would it also be possible to have the compression set to 'maximum' of the jpg files?

Don't know anything about indesign scripting, but I'm guessing something like:

app.jpegExportPreferences.compression = maximum;

?

It would also be nice of the file names were easier formatted. Now it saves files like this:

document1.indd.jpg

document1.indd2.jpg

document1.indd3.jpg

document2.indd.jpg

document2.indd.jpg

Could the for loop be edited to make the book files look like this for example?

page1.jpg

page2.jpg

page3.jpg

page4.jpg

page5.jpg

So if the book of all indesign documents add up to 36 pages, the exported file names of the book would run from page1.jpg to page36.jpg?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 19, 2010 Apr 19, 2010

Allready found the answer to the first question 😉

app.jpegExportPreferences. jpegQuality = MAXIMUM;

Am I correct?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 19, 2010 Apr 19, 2010

No.

I thought I listed all properties but forgot that one. It ought to be

app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM;

(JPEG exporting is not mentioned in the Adobe InDesign CS4 Scripting Guide: JavaScript; but I found this in the Javascript Help that came free with your ESTK.)

About the file naming: it's not possible to change the output file name, just like in the interface itself. There are a few (very few) things you can do with scripting that cannot be done in the interface but this is not one of them.

It is possible to rename any file with Javascript, so (theoretically) you could export all files first. Since the default name seems to be "originalfile" + pagenumber (expect for page 1) + ".jpg", you could use that to rename them to whatever you want. However, at least under Windows, it's far easier to just select them all and rename the first one (Windows will add a sequential number to the files), or use the DOS command line. There are also special utilities to batch rename files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 19, 2010 Apr 19, 2010

Ok thanks, Also for the pdf. I read somewhere that that guide was about 2000 pages, so I thought 'never mind', but with 168 pages I think I just might read it 😉

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 19, 2010 Apr 19, 2010
LATEST

It's a good introduction to the InDesign Document Object Model. If you already have an inkling of Javascript, you ought to be able to pick up the specifics soon enough.

The Javascript additions for InDesign add up to 579 separate object classes and some additional 306 dedicated enumerations (even in that small script I showed I already had to use 4). Good news is, you'll come quite far with just a basic set -- no need to memorize all of them.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines