indesign thumbnails?

813 views
Skip to first unread message

tom

unread,
Mar 20, 2008, 2:15:04 PM3/20/08
to ResourceSpace
What is the chance of indesign thumbnails being possible for RS?

tom

unread,
Mar 21, 2008, 11:25:06 AM3/21/08
to ResourceSpace
I seem to have made some progess in this area. It appears to be
possible.

The jpeg is encoded in Base64, which would be easy enough to rip out
and store as a blob, and display in base64 encoding in html (works on
Firefox, not sure about IE)....But, that wouldn't really be the way to
do it, since the image wouldn't get cached, and would likely be too
big or too small and have to be creatively resized throughout the
website.

Anyone have any ideas about how to decode such a data string and turn
it into a proper jpeg file?

Tom Gleason

unread,
Mar 21, 2008, 12:40:53 PM3/21/08
to ResourceSpace
I think I mean as text, not a blob...

andyb

unread,
Mar 21, 2008, 2:48:52 PM3/21/08
to ResourceSpace
Mac OS and Windows differ slightly you be surprised to hear.
Mac OS saves two previews a JPEG and a PICT.

On mac OS you can open the PICT by
file menu/open..
choose enable: All documents
Format: Pict Resource

Adobes' scant documentation on thumbnails is here

http://livedocs.adobe.com/en_US/InDesign/5.0/help.html?content=WSa285fff53dea4f8617383751001ea8cb3f-6d4f.html

cataloguing and library products do not use the pict afaik, its the
jpeg they pickup.

XMP metadata btw has nothing to do with the links.
InDesign stores all the links and all the metadata of all the links
too. Its fantastic in this respect.

Tom Gleason

unread,
Mar 21, 2008, 3:06:11 PM3/21/08
to resour...@googlegroups.com
Thanks. I see some font and spot color information as well in there, which would be pretty cool to get....

The Base64 encoded string is in a section that looks like this:

<xap:Thumbnails>
            <rdf:Alt>
               <rdf:li rdf:parseType="Resource">
                  <xapGImg:format>JPEG</xapGImg:format>
                  <xapGImg:width>512</xapGImg:width>
                  <xapGImg:height>512</xapGImg:height>
....Base64 string....               
            </rdf:li>
            </rdf:Alt>
         </xap:Thumbnails>


Now, it seems that there can be several sections like this in a file, and only the last one is good. The earlier ones seem corrupt. Have to figure out some PHP code to detect the pattern and extract the JPEG.

tom

unread,
Mar 21, 2008, 4:23:45 PM3/21/08
to ResourceSpace
This post was supposed to go in this thread, not Indesign Links:

have to take the spaces out of the base64 text, write it to a file or
modify
the function below to just take a text string.

I found this on http://us2.php.net/manual/en/function.base64-decode.php

<?php
function base64_to_jpeg( $inputfile, $outputfile ) {
/* read data (binary) */
$ifp = fopen( $inputfile, "rb" );
$imageData = fread( $ifp, filesize( $inputfile ) );
fclose( $ifp );
/* encode & write data (binary) */
$ifp = fopen( $outputfile, "wb" );
fwrite( $ifp, base64_decode( $imageData ) );
fclose( $ifp );
/* return output filename */
return( $outputfile );
}

?>

This gives me an actual jpeg file to work with, which is very good.

tom

unread,
Mar 21, 2008, 4:27:21 PM3/21/08
to ResourceSpace
Above, where it says ....Base64 string....., it should actually read:

</xapGImg:image>...base64 String.....</xapGImg:image>

I left those tags out, which are really the key tags around the data
string.

Dan Huby

unread,
Mar 23, 2008, 3:56:24 PM3/23/08
to ResourceSpace

It looks like there's been some interesting progress on this.

Do I read correctly that the embedded preview image is 512x512 pixels?
That should be good enough for previewing within ResourceSpace. You
shouldn't need to store it in the database, just decode it and save it
to disk as a JPEG and then perform the usual image resize process (in
fact it could sit inside imagemagick.php and work the same way as for
video files with ffmpeg?).

If you get some working code together it would be good to add it to
the base.

Dan

Tom Gleason

unread,
Mar 23, 2008, 10:36:33 PM3/23/08
to resour...@googlegroups.com
The embedded preview is of a size chosen by the InDesign user, in the Preferences menu. There, you can choose whether to even save a thumbnail, and whether the size will be small, medium, large, or extra large (128,256,512,1028). The users would probably be best off selecting the largest preview, since the quality of any images in the preview thumbnail is a bit grainy ("FPO" style). The font resolution in the thumbnail is very good.

I've also been lucky enough to find a simple way to extract the XMP data with PHP.

I will let you know how it goes.
Message has been deleted

Tom Gleason

unread,
Mar 26, 2008, 10:53:34 AM3/26/08
to resour...@googlegroups.com
Here is the code for anyone who is interested in testing.

Two functions included need to be added to image_processing.php, and a conditional (IF ".indd" THEN run thumbnail extraction) is added to the imagemagick.php file after the ffmpeg section.
We can contribute these to the base code, and I hope it stimulates some more development for prepress asset management with RS.

Note, When you save your INDD file, InDesign Preferences must be set to save Preview images, and for best results, the Preview size should be Extra Large.
If no Preview was saved with the InDesign document, then it will behave as before with "Preview Unavailable".

Also, in my imagemagick command, notice the "-quality 90 option" and the "-density 200x200" option. These can dramatically improve the quality of thumbnails from vector art, such as PDFs and AIs.
imagemagick.php
add_to_image_processing.php
Reply all
Reply to author
Forward
Message has been deleted
0 new messages