Skip to main content
natrev
Legend
September 7, 2015
Answered

is this possible to get EPS save encoding (ie.. BINARY, ASCII, ASCII85)

  • September 7, 2015
  • 3 replies
  • 2393 views

Hi Everyone,

is this possible to get EPS save encoding like BINARY, ASCII, ASCII85, JPEG(low)..

Thanks in advance.

-yajiv

This topic has been closed for replies.
Correct answer

The format of Photoshop EPS files is partially documented here:

http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1035096

Photoshop includes a comment in the EPS files it writes so that it is able to read them back in again. Third party programs that write pixel-based EPS files may want to include this comment in their EPS files, so Photoshop can read their files.

The comment must follow immediately after the %% comment block at the start of the file. The comment is:

%ImageData: <columns> <rows> <depth> <mode> <pad channels> <block size> <binary/hex> "<data start>"

<columns>: Width of the image in pixels.

<rows>: Height of the image in pixels.

<depth>: Number of bits per channel. Must be 1 or 8.

<mode>: Image mode. Bitmap/grayscale = 1; Lab = 2; RGB = 3; CMYK = 4.

<pad channels>: Number of other channels store in the file. Ignored when reading. Photoshop uses this to include a grayscale image that is printed on non-color PostScript printers.

<block size>:Number of bytes per row per channel. Will be either 1 or formula (below):

  1 = Data is interleaved.

  (columns*depth+7)/8 = Data is stored in line-interleaved format, or there is only one channel.

<binary/hex>:

  1 = Data is in binary format.

  2 = Data is in hex ascii format.

<data start>: Entire PostScript line immediately preceding the image data. This entire line should not occur elsewhere in the PostScript header code, but it may occur at part of a line.

Besides, some information about other values of <binary/hex> can be found here:

http://python.6.x6.nabble.com/Correctly-determine-image-size-of-a-Photoshop-EPS-td2096786.html

1 - binary

2 - ascii

3 - jpeg low quality

4 - jpeg medium quality

5 - jpeg high quality

6 - jpeg maximum quality

7 - ascii85

Here is a test script using this information:

function main ()

{

    function isPhotoshopEPSFile (f)

    {

        return (f.type === 'EPSF') || f.name.match (/\.eps$/i);

    }

    var epsFilter =

        (File.fs === "Macintosh") ?

            function (f) { return (f instanceof Folder) || isPhotoshopEPSFile (f) } :

            "Photoshop EPS Files:*.eps,All Files:*.*";

    var epsFile = File.openDialog ("Open Photoshop EPS file:", epsFilter);

    if (epsFile)

    {

        if (epsFile.open ("r"))

        {

            while (!epsFile.eof)

            {

                var line = epsFile.readln ();

                var found = line.match (/^%ImageData:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/);

                if (found)

                {

                    var dataFormatIndex = found[7];

                    var dataFormats =

                    [

                        "Binary",

                        "ASCII",

                        "JPEG (low quality)",

                        "JPEG (medium quality)",

                        "JPEG (high quality)",

                        "JPEG (maximum quality)",

                        "ASCII85"

                    ];

                    alert (dataFormats[dataFormatIndex - 1]);

                    break;

                }

            }

            epsFile.close ();

        }

    }

}

main ();

HTH,

--Mikaeru

3 replies

Correct answer
September 8, 2015

The format of Photoshop EPS files is partially documented here:

http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1035096

Photoshop includes a comment in the EPS files it writes so that it is able to read them back in again. Third party programs that write pixel-based EPS files may want to include this comment in their EPS files, so Photoshop can read their files.

The comment must follow immediately after the %% comment block at the start of the file. The comment is:

%ImageData: <columns> <rows> <depth> <mode> <pad channels> <block size> <binary/hex> "<data start>"

<columns>: Width of the image in pixels.

<rows>: Height of the image in pixels.

<depth>: Number of bits per channel. Must be 1 or 8.

<mode>: Image mode. Bitmap/grayscale = 1; Lab = 2; RGB = 3; CMYK = 4.

<pad channels>: Number of other channels store in the file. Ignored when reading. Photoshop uses this to include a grayscale image that is printed on non-color PostScript printers.

<block size>:Number of bytes per row per channel. Will be either 1 or formula (below):

  1 = Data is interleaved.

  (columns*depth+7)/8 = Data is stored in line-interleaved format, or there is only one channel.

<binary/hex>:

  1 = Data is in binary format.

  2 = Data is in hex ascii format.

<data start>: Entire PostScript line immediately preceding the image data. This entire line should not occur elsewhere in the PostScript header code, but it may occur at part of a line.

Besides, some information about other values of <binary/hex> can be found here:

http://python.6.x6.nabble.com/Correctly-determine-image-size-of-a-Photoshop-EPS-td2096786.html

1 - binary

2 - ascii

3 - jpeg low quality

4 - jpeg medium quality

5 - jpeg high quality

6 - jpeg maximum quality

7 - ascii85

Here is a test script using this information:

function main ()

{

    function isPhotoshopEPSFile (f)

    {

        return (f.type === 'EPSF') || f.name.match (/\.eps$/i);

    }

    var epsFilter =

        (File.fs === "Macintosh") ?

            function (f) { return (f instanceof Folder) || isPhotoshopEPSFile (f) } :

            "Photoshop EPS Files:*.eps,All Files:*.*";

    var epsFile = File.openDialog ("Open Photoshop EPS file:", epsFilter);

    if (epsFile)

    {

        if (epsFile.open ("r"))

        {

            while (!epsFile.eof)

            {

                var line = epsFile.readln ();

                var found = line.match (/^%ImageData:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/);

                if (found)

                {

                    var dataFormatIndex = found[7];

                    var dataFormats =

                    [

                        "Binary",

                        "ASCII",

                        "JPEG (low quality)",

                        "JPEG (medium quality)",

                        "JPEG (high quality)",

                        "JPEG (maximum quality)",

                        "ASCII85"

                    ];

                    alert (dataFormats[dataFormatIndex - 1]);

                    break;

                }

            }

            epsFile.close ();

        }

    }

}

main ();

HTH,

--Mikaeru

natrev
natrevAuthor
Legend
September 9, 2015

Thanks xbytor and Mikaeru,

Its Awesome.....:) and that was what i needed. 

Once again Thanks for your support.

-yajiv

natrev
natrevAuthor
Legend
September 8, 2015

Hi xbytor,

Thanks for your reply. Does not given any information in metadata exif.

Since the metadata means data about data information which is derived from image.

Is possible to get or not?

-yajiv

Inspiring
September 8, 2015

If the info you need is not in the exif metadata you will need to scan the image file. I don't have the EPS file format spec at my fingertips so I can't tell you how to find the encoding part of the spec. Take a trip on google and see if you can find it.

natrev
natrevAuthor
Legend
September 8, 2015

Hi xbytor,

Once again thanks for your reply. I tried lot on google but I can't find..

Please help me the Binary value of Save encoding for BINARY or ASCII or ASCII85.

Since I get binary value for Clipping path , Normal path and work path available in document. Hence save encoding has binary value. If possible can you find that binary value..?

Ex:

Path = '8BIM\x07\xd0'

Clipping Path = '8BIM\x0b\xb7'

WorkPath = '8BIM\x04\x01'

Inspiring
September 7, 2015

Usually, the only way to get information like this is to scan the file. There may be something in the exif data so you might want to check there first.