Manual conversion from Generic EPS to Photoshop EPS

Discussion in 'Photoshop Tutorials' started by Michael, Jan 9, 2004.

  1. Michael

    Michael Guest

    Hi,
    starting point is a generic eps file which should be converted into a
    photoshop eps file manually. I am familiar with the document Adobe
    Photoshop File Formats Specificaction provided by Adobe which
    describes briefly the required steps (inserting imagedata tag).
    Unfortunately there is still a question of how to merge the two
    different syntaxes (generic eps and photoshop eps).

    Can anybody tell me what (and where) I have to insert/modify to get a
    photoshop eps that does not ask for rasterizing information (see the
    generic eps file below)?

    Thanks a lot for your help.

    Michael

    ---
    Here is an excerpt of the mentioned generic eps file generated by
    imagemagick (respectively ghostscript):

    %!PS-Adobe-3.0 EPSF-3.0
    %%Creator: (ImageMagick)
    %%Title: (image.eps)
    %%CreationDate: (Tue Dec 30 19:03:19 2003)
    %%BoundingBox: 0 0 300 200
    %%HiResBoundingBox: 0 0 300 200
    %%LanguageLevel: 2
    %%Pages: 1
    %%EndComments

    %%BeginDefaults
    %%EndDefaults

    %%BeginProlog
    %
    % Display a color image. The image is displayed in color on
    % Postscript viewers or printers that support color, otherwise
    % it is displayed as grayscale.
    %
    /DirectClassImage
    {
    %
    % Display a DirectClass image.
    %
    colorspace 0 eq
    {
    /DeviceRGB setcolorspace
    <<
    /ImageType 1
    /Width columns
    /Height rows
    /BitsPerComponent 8
    /Decode [0 1 0 1 0 1]
    /ImageMatrix [columns 0 0 rows neg 0 rows]
    compression 0 gt
    { /DataSource pixel_stream /RunLengthDecode filter }
    { /DataSource pixel_stream /RunLengthDecode filter } ifelse}
    {
    /DeviceCMYK setcolorspace
    <<
    /ImageType 1
    /Width columns
    /Height rows
    /BitsPerComponent 8
    /Decode [1 0 1 0 1 0 1 0]
    /ImageMatrix [columns 0 0 rows neg 0 rows]
    compression 0 gt
    { /DataSource pixel_stream /RunLengthDecode filter }
    { /DataSource pixel_stream /RunLengthDecode filter } ifelse} ifelse
    } bind def

    /PseudoClassImage
    {
    %
    % Display a PseudoClass image.
    %
    % Parameters:
    % colors: number of colors in the colormap.
    %
    currentfile buffer readline pop
    token pop /colors exch def pop
    colors 0 eq
    {
    %
    % Image is grayscale.
    %
    currentfile buffer readline pop
    token pop /bits exch def pop
    /DeviceGray setcolorspace
    <<
    /ImageType 1
    /Width columns
    /Height rows
    /BitsPerComponent bits
    /Decode [0 1]
    /ImageMatrix [columns 0 0 rows neg 0 rows]
    compression 0 gt
    { /DataSource pixel_stream /RunLengthDecode filter }
    {
    /DataSource pixel_stream /RunLengthDecode filter
    <<
    /K -1
    /Columns columns
    /Rows rows}
    {
    %
    % Parameters:
    % colormap: red, green, blue color packets.
    %
    /colormap colors 3 mul string def
    currentfile colormap readhexstring pop pop
    currentfile buffer readline pop
    [ /Indexed /DeviceRGB colors 1 sub colormap ] setcolorspace
    <<
    /ImageType 1
    /Width columns
    /Height rows
    /BitsPerComponent 8
    /Decode [0 255]
    /ImageMatrix [columns 0 0 rows neg 0 rows]
    compression 0 gt
    { /DataSource pixel_stream /RunLengthDecode filter }
    { /DataSource pixel_stream /RunLengthDecode filter } ifelse} ifelse
    } bind def

    /DisplayImage
    {
    %
    % Display a DirectClass or PseudoClass image.
    %
    % Parameters:
    % x & y translation.
    % x & y scale.
    % label pointsize.
    % image label.
    % image columns & rows.
    % class: 0-DirectClass or 1-PseudoClass.
    % colorspace: 0-RGB or 1-CMYK.
    % compression: 0-RLECompression or 1-NoCompression.
    % hex color packets.
    %
    gsave
    /buffer 512 string def
    /pixel_stream currentfile def

    currentfile buffer readline pop
    token pop /x exch def
    token pop /y exch def pop
    x y translate
    currentfile buffer readline pop
    token pop /x exch def
    token pop /y exch def pop
    currentfile buffer readline pop
    token pop /pointsize exch def pop
    /Helvetica findfont pointsize scalefont setfont
    x y scale
    currentfile buffer readline pop
    token pop /columns exch def
    token pop /rows exch def pop
    currentfile buffer readline pop
    token pop /class exch def pop
    currentfile buffer readline pop
    token pop /colorspace exch def pop
    currentfile buffer readline pop
    token pop /compression exch def pop
    class 0 gt { PseudoClassImage } { DirectClassImage } ifelse
    grestore
    } bind def
    %%EndProlog
    %%Page: 1 1
    %%PageBoundingBox: 0 0 300 200

    userdict begin
    %%BeginData: 241942 Binary Bytes
    DisplayImage
    0 0
    300 200
    12.000000
    300 200
    0
    1
    0
    ~Y Y Y X Y Y X X Y Y X Y Y Y Y X Y
    X Y
    .....

    %%EndData
    end
    %%PageTrailer
    %%Trailer
    %%BoundingBox: 0 0 300 200
    %%HiResBoundingBox: 0 0 300 200
    %%EOF
     
    Michael, Jan 9, 2004
    #1
    1. Advertisements

  2. Michael

    Tacit Guest

    Can anybody tell me what (and where) I have to insert/modify to get a
    Your generic EPS is a vector (outline) EPS. Photoshop EPS files are raster
    (pixel) EPS files. These two types of EPS files are very different.

    You can't get from vector to raster without first...er, rasterizing.
     
    Tacit, Jan 11, 2004
    #2
    1. Advertisements

  3. Michael

    Michael Guest

    Thank you for your answer. But thats basically clear. The main
    difference between the two formats according to the Photoshop SDK
    documentation is that Photoshop needs information on how to rasterize
    the images. Therefore it includes a comment into the eps file which is
    only interpreted by photoshop itself: e.g. ' %ImageData: 1892 1741 8 4
    0 1 6 "beginimage" '

    This is basically the information you have to enter into the dialog
    box when photoshop asks for rasterizing information after opening a
    generic eps file. So my goal is to avoid this dialog box by including
    the information into the eps file directly. The question is how to do
    this. It should be possible according to the Photoshop SDK.

    Thank you for any further help.

    Michael
     
    Michael, Jan 12, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.