realbasic-nug
[Top] [All Lists]

Re: EPS Preview

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: EPS Preview
From: Peter Truskier <peter at premediasystems dot com>
Date: Fri, 29 Feb 2008 11:51:37 -0800
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <1id2u7f dot g0w5donwma6lM%realbasiclists at monkeybreadsoftware dot de> <C418065B-3B53-4D47-AC76-D541C73452DF at westfalen-blatt dot de>
>
> Thanks for the fast reply. The challenge is to open a pict preview and
> save it as a tiff preview within the eps. Any chance to geht things
> going with ghostscript and MBS?
>

I don't think you want or need GhostScript for this. If the EPS has a  
PICT resource preview, then you can create an RB picture object from  
it. Next, you'll want to get the TIFF data of this picture (e.g., use  
MBS to write it to a temp file). Finally, you'll need to understand  
the Adobe EPS spec as it concerns embedded TIFF previews. You can  
find the spec here:

<partners.adobe.com/public/ developer/en/ps/5002.EPSF_Spec.pdf>

Basically, you'll have to add a header to what's in the data fork of  
your EPS. Glue the header, the TIFF data, and the PostScript data  
together, write it all out to a binary file, and voilà.

The 30 byte header will specify offsets and lengths for various  
sections of the file (as described in the spec:

> Bytes Description
> 0-3   Must be hex C5D0D3C6 (byte 0=C5).
> 4-7   Byte position in file for start of PostScript language code  
> section.
> 8-11  Byte length of PostScript language section.
> 12-15 Byte position in file for start of Metafile screen  
> representation.
> 16-19 Byte length of Metafile section (PSize).
> 20-23 Byte position of TIFF representation.
> 24-27 Byte length of TIFF section.
> 28-29 Checksum of header (XOR of bytes 0-27). If Checksum is FFFF  
> then ignore it

HTH,

Peter

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>