tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
2
ZUGRIFFE
807
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Dandyduck Dandyduck ist offline Grünschnabel
    Registriert seit
    Oct 2010
    Beiträge
    1
    Hallo miteinander,


    ich habe ein gewaltiges Problem mit dem Extrahieren von Bildern aus einem EPS, welches in InDesign erstellt wurde.

    Grundlage:

    %ALDImageFileName: Speicher:kleinsbildirgendwieirgendwaswiedueshabenwillst.jpg
    %ALDImageDimensions: 30 30
    %ALDImageCropRect: 0 0 30 30
    %ALDImageCropFixed: 0 0 30 30
    %ALDImagePosition: 203.8677 344.8913 203.8677 359.2913 218.2677 359.2913 218.2677 344.8913
    %ALDImageType: 4 8
    %%BeginObject: image
    [14.4 0 0 14.4 203.868 344.891 ]ct
    snap_to_device
    Adobe_AGM_Image/AGMIMG_fl cf /ASCII85Decode fl /RunLengthDecode filter ddf
    <<
    /T 1
    /W 30
    /H 30
    /M[30 0 0 -30 0 30 ]
    /BC 8
    /D[0 1 0 1 0 1 0 1 ]
    /DS [
    [AGMIMG_fl 30 string /rs cvx /pop cvx] cvx
    [AGMIMG_fl 30 string /rs cvx /pop cvx] cvx
    [AGMIMG_fl 30 string /rs cvx /pop cvx] cvx
    [AGMIMG_fl 30 string /rs cvx /pop cvx] cvx
    ]
    /O 3
    >>
    %%BeginBinary: 1
    img
    p&G-p!<E*"!<<3"******&i!!30$!Vl`q!V$-m!WW3&!r`0#!Wh]h!!20]!WW3$qZ$^******!&f!!30$!WE'!
    !WE'$!<<*#nc/[l!W<!#!WW3%h>dNVnGiXl!<<-)!!*'"!<<2f!<*$!!<3)a******&t!!*-%kl:\ar;Zm"
    !!2He#6G2G(D[>Z!<*#e!!WKUEK,/l!r`0"!V$.!!Wi?'-t[mD-NjDN!!2Zk!!3#u"T\]4$OR%8******&h
    !!<6)*\I@D!\,8pq>g3h%KQP0';ta-rr2ho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frY5G=!Vufj!"K#0!#mOB.0(kM0,afj!V$-u!<A8^s6B[Es8S8_!U]poKBMCG
    !7'`iKECN@#RhF_'*&[\'b'X5r;[9-!$a!F*W[<7.jP)q!V-4#!<<,As8T>(W;lnB******&g!"63skFhmD
    jlEuS!!2Ng#S7^d%KHtR'bTm7!s/H(/-mj['`\n!/1Ukk!"985s8@'?Du]k7%KHP#!"8l0$KC71C'%l,
    jl$a?!!<6%!!3'6!X\o6rY5J8!!2Qh#Ri::0*_I`/1U`S%.4)q5Q:Zg2ukf6s8P=a!V$-t!]]?)jY?ff
    kN:qhmJmFp()7Pf!!N99!!Vcj$l1NL.KKPM/1iIi!!3'!o`,F%!dakFpBL[$pAb/A!Up's!H@5cf`qK\
    hWF!BmJmV%'GV;_!!*`J'FFm3!!WH(!?WpE,Q7ZH+tP;f!!2foq>^W-s8Tn6!!L"8s0r.!!">[bkcXsf
    !3>;FU]CPd!!<]G'bL?E!tZ.^&+9K$!\#`P)?'U>'eM$g!!2Zk!W`9$$g.KhLB.ATL&_2?"7Q9n!RU)n
    I/X*KGN@l9"Rc<t',;8j******$,'bhAP!!WQ+!"US5%fQG1%PKFQn,NUm!*fL'9)\en8,rO]!V-4"!rrBu
    jQ/].!WYOLl&b?6"9AcD'aFX;"9oSU%0>nt$NV(q!rr<%"YC_q"7Z@"!<<+Eq@Wc/!#,C9"9&;k!!E?)
    D;u0+!!<qtS-&0["T\T'$5EXA!!33:%da5t!<<]/!!3u<!V$-o!<<*#!FZ$-!!A;d!!2ipq#CKu!<?7$
    !!WK)KEM8T"RZ6i$2so,!<<Q0li77k!!30$!<</h******'******E<'******&c!"8o/!!*'#"98E'!WW;h******'!
    !!NB'!<<*#n,N[o!<<*#******'******!&f!!E<&!!*-"******'********%o)K!s!!*-$!<<*#!!<-"!Wi?&l2Ueb
    rVup!q#Gp~>

    %%EndBinary
    %%EndObject


    Orginal Bild Größe 553,9 KB

    Nach dem decode nur noch eine Größe von 1,8 KB

    Versuch 1.

    public class ASCII85Decode {

    private ByteBuffer buf;

    /**
    * initialize the decoder with byte buffer in ASCII85 format
    */
    private ASCII85Decode(ByteBuffer buf) {
    this.buf = buf;
    }



    /**
    * get the next character from the input.
    * @return the next character, or -1 if at end of stream
    */
    private int nextChar() {
    // skip whitespace
    // returns next character, or -1 if end of stream
    while (buf.remaining() > 0) {
    char c = (char) buf.get();

    if (!isWhiteSpace(c)) {
    return c;
    }
    }

    // EOF reached
    return -1;
    }

    public static boolean isWhiteSpace(int c) {
    return (c == ' ' || c == '\t' || c == '\r' || c == '\n'
    || c == 0 || c == 12);
    // 0=nul, 12=ff
    }

    /**
    * decode the next five ASCII85 characters into up to four decoded
    * bytes. Return false when finished, or true otherwise.
    *
    * @param baos the ByteArrayOutputStream to write output to, set to the
    * correct position
    * @return false when finished, or true otherwise.
    */
    private boolean decode5(ByteArrayOutputStream baos)
    throws PDFParseException {
    // stream ends in ~>
    int[] five = new int[5];
    int i;
    for (i = 0; i < 5; i++) {
    five[i] = nextChar();
    if (five[i] == '~') {
    if (nextChar() == '>') {
    break;
    } else {
    throw new PDFParseException(
    "Bad character in ASCII85Decode: not ~>");
    }
    } else if (five[i] >= '!' && five[i] <= 'u') {
    five[i] -= '!';
    } else if (five[i] == 'z') {
    if (i == 0) {
    five[i] = 0;
    i = 4;
    } else {
    throw new PDFParseException(
    "Inappropriate 'z' in ASCII85Decode");
    }
    } else {
    throw new PDFParseException(
    "Bad character in ASCII85Decode: " + five[i]
    + " (" + (char) five[i] + ")");
    }
    }

    if (i > 0) {
    i -= 1;
    }

    int value = five[0] * 85 * 85 * 85 * 85 + five[1] * 85 * 85
    * 85 + five[2] * 85 * 85 + five[3] * 85 + five[4];

    for (int j = 0; j < i; j++) {
    int shift = 8 * (3 - j);
    baos.write((byte) ((value >> shift) & 0xff));
    }

    return (i == 4);
    }

    /**
    * decode the bytes
    * @return the decoded bytes
    */
    private ByteBuffer decode() throws PDFParseException {
    // start from the beginning of the data
    buf.rewind();

    // allocate the output buffer
    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    // decode the bytes
    while (decode5(baos)) {
    }

    return ByteBuffer.wrap(baos.toByteArray());
    }

    /**
    * decode an array of bytes in ASCII85 format.
    * <p>
    * In ASCII85 format, every 5 characters represents 4 decoded
    * bytes in base 85. The entire stream can contain whitespace,
    * and ends in the characters '~&gt;'.
    *
    * @param buf the encoded ASCII85 characters in a byte buffer
    * @param params parameters to the decoder (ignored)
    * @return the decoded bytes
    */
    public static ByteBuffer decode(ByteBuffer buf)
    throws PDFParseException {
    ASCII85Decode me = new ASCII85Decode(buf);
    return me.decode();
    }


    }


    Versuch 2.

    public class Ascii85Decode {
    private final FileOutputStream fos;

    private Ascii85Decode() throws FileNotFoundException {
    File f = new File("/home/markus/1/test/bild.jpg");
    fos = new FileOutputStream(f);

    }

    @Override
    protected void finalize() throws Throwable {
    fos.close();
    super.finalize();
    }



    public static byte[] decode(byte[] in) throws FileNotFoundException, IOException {
    Ascii85Decode ascii85Decode = new Ascii85Decode();
    ascii85Decode.setData(in);
    ascii85Decode.decode85();

    return null;
    }
    static long pow85[] = {85 * 85 * 85 * 85, 85 * 85 * 85, 85 * 85, 85, 1};
    private byte[] in;


    private void setData(byte[] in) {
    this.in = in;
    }

    void wput(long tuple, int bytes) throws IOException {
    switch (bytes) {
    case 4:
    putchar((int) (tuple >> 24));
    putchar((int) (tuple >> 16));
    putchar((int) (tuple >> 8));
    putchar((int) tuple);
    break;
    case 3:
    putchar((int) (tuple >> 24));
    putchar((int) (tuple >> 16));
    putchar((int) (tuple >> 8));
    break;
    case 2:
    putchar((int) (tuple >> 24));
    putchar((int) (tuple >> 16));
    break;
    case 1:
    putchar((int) (tuple >> 24));
    break;

    }
    }

    void decode85() throws IOException {
    long tuple = 0;
    int c, count = 0;
    int i=0;
    for (; {
    switch (c = in[i]) {
    default:
    if (c < '!' || c > 'u') {
    System.err.println("%s: bad character in ascii85 region: %#o\n");
    System.exit(1);
    }
    tuple += (c - '!') * pow85[count++];
    if (count == 5) {
    wput(tuple, 4);
    count = 0;
    tuple = 0;
    }
    break;
    case 'z':

    if (count != 0) {
    System.err.println("%s: z inside ascii85 5-tuple\n");
    System.exit(1);
    }
    putchar(0);
    putchar(0);
    putchar(0);
    putchar(0);
    break;
    case '~':
    if (in[i+1] == '>') {
    if (count > 0) {
    count--;
    tuple += pow85[count];
    wput(tuple, count);

    }
    c = in[i+1];
    return;
    }
    System.err.println("%s: ~ without > in ascii85 section\n");
    System.exit(1);
    case '\n':
    case '\r':
    case '\t':
    case ' ':
    case '\0':
    case '\f':
    case '\b':
    case 0177:
    break;

    }
    i++;
    }


    }

    private void putchar(int l) throws IOException {
    //System.out.write(l);
    fos.write(l);
    }
    }


    Ich wäre sehr dankbar, wenn mir da jemand bei der Problembehebung helfen könnte!


    Gruß Ducky
     

  2. #2
    genodeftest genodeftest ist offline Mitglied Brillant
    Registriert seit
    Jun 2009
    Beiträge
    868
    Hi
    kannst du deinen code bitte in [ c o d e ] [ / c o d e ] (ohne Leerzeichen) fassen, so wie du ihn hier hinein kopiert hast, kann man ihn nicht lesen******
     

  3. #3
    Tsunamii Tsunamii ist offline Mitglied Silber
    Registriert seit
    Jul 2009
    Beiträge
    75
    Code java:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    
    public class ASCII85Decode {
     
        private ByteBuffer buf;
     
        /**
         * initialize the decoder with byte buffer in ASCII85 format
         */
        private ASCII85Decode(ByteBuffer buf) {
            this.buf = buf;
        }
     
        /**
         * get the next character from the input.
         * 
         * @return the next character, or -1 if at end of stream
         */
        private int nextChar() {
            // skip whitespace
            // returns next character, or -1 if end of stream
            while (buf.remaining() > 0) {
                char c = (char) buf.get();
     
                if (!isWhiteSpace(c)) {
                    return c;
                }
            }
     
            // EOF reached
            return -1;
        }
     
        public static boolean isWhiteSpace(int c) {
            return (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0 || c == 12);
            // 0=nul, 12=ff
        }
     
        /**
         * decode the next five ASCII85 characters into up to four decoded bytes.
         * Return false when finished, or true otherwise.
         * 
         * @param baos
         *            the ByteArrayOutputStream to write output to, set to the
         *            correct position
         * @return false when finished, or true otherwise.
         */
        private boolean decode5(ByteArrayOutputStream baos)
                throws PDFParseException {
            // stream ends in ~>
            int[] five = new int[5];
            int i;
            for (i = 0; i < 5; i++) {
                five[i] = nextChar();
                if (five[i] == '~') {
                    if (nextChar() == '>') {
                        break;
                    } else {
                        throw new PDFParseException(
                                "Bad character in ASCII85Decode: not ~>");
                    }
                } else if (five[i] >= '!' && five[i] <= 'u') {
                    five[i] -= '!';
                } else if (five[i] == 'z') {
                    if (i == 0) {
                        five[i] = 0;
                        i = 4;
                    } else {
                        throw new PDFParseException(
                                "Inappropriate 'z' in ASCII85Decode");
                    }
                } else {
                    throw new PDFParseException("Bad character in ASCII85Decode: "
                            + five[i] + " (" + (char) five[i] + ")");
                }
            }
     
            if (i > 0) {
                i -= 1;
            }
     
            int value = five[0] * 85 * 85 * 85 * 85 + five[1] * 85 * 85 * 85
                    + five[2] * 85 * 85 + five[3] * 85 + five[4];
     
            for (int j = 0; j < i; j++) {
                int shift = 8 * (3 - j);
                baos.write((byte) ((value >> shift) & 0xff));
            }
     
            return (i == 4);
        }
     
        /**
         * decode the bytes
         * 
         * @return the decoded bytes
         */
        private ByteBuffer decode() throws PDFParseException {
            // start from the beginning of the data
            buf.rewind();
     
            // allocate the output buffer
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
     
            // decode the bytes
            while (decode5(baos)) {
            }
     
            return ByteBuffer.wrap(baos.toByteArray());
        }
     
        /**
         * decode an array of bytes in ASCII85 format.
         * <p>
         * In ASCII85 format, every 5 characters represents 4 decoded bytes in base
         * 85. The entire stream can contain whitespace, and ends in the characters
         * '~&gt;'.
         * 
         * @param buf
         *            the encoded ASCII85 characters in a byte buffer
         * @param params
         *            parameters to the decoder (ignored)
         * @return the decoded bytes
         */
        public static ByteBuffer decode(ByteBuffer buf) throws PDFParseException {
            ASCII85Decode me = new ASCII85Decode(buf);
            return me.decode();
        }
     
    }
    Code java:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    
    public class ASCII85Decode {
        private final FileOutputStream fos;
     
        private ASCII85Decode() throws FileNotFoundException {
            File f = new File("/home/markus/1/test/bild.jpg");
            fos = new FileOutputStream(f);
     
        }
     
        @Override
        protected void finalize() throws Throwable {
            fos.close();
            super.finalize();
        }
     
        public static byte[] decode(byte[] in) throws FileNotFoundException,
                IOException {
            Ascii85Decode ascii85Decode = new Ascii85Decode();
            ascii85Decode.setData(in);
            ascii85Decode.decode85();
     
            return null;
        }
     
        static long pow85[] = { 85 * 85 * 85 * 85, 85 * 85 * 85, 85 * 85, 85, 1 };
        private byte[] in;
     
        private void setData(byte[] in) {
            this.in = in;
        }
     
        void wput(long tuple, int bytes) throws IOException {
            switch (bytes) {
            case 4:
                putchar((int) (tuple >> 24));
                putchar((int) (tuple >> 16));
                putchar((int) (tuple >> 8));
                putchar((int) tuple);
                break;
            case 3:
                putchar((int) (tuple >> 24));
                putchar((int) (tuple >> 16));
                putchar((int) (tuple >> 8));
                break;
            case 2:
                putchar((int) (tuple >> 24));
                putchar((int) (tuple >> 16));
                break;
            case 1:
                putchar((int) (tuple >> 24));
                break;
     
            }
        }
     
        void decode85() throws IOException {
            long tuple = 0;
            int c, count = 0;
            int i=0;
            for (; {
                switch (c = in[i]) {
                default:
                    if (c < '!' || c > 'u') {
                        System.err.println("%s: bad character in ascii85 region: %#o\n");
                        System.exit(1);
                    }
                    tuple += (c - '!') * pow85[count++];
                    if (count == 5) {
                        wput(tuple, 4);
                        count = 0;
                        tuple = 0;
                    }
                    break;
                case 'z':
     
                    if (count != 0) {
                        System.err.println("%s: z inside ascii85 5-tuple\n");
                        System.exit(1);
                    }
                    putchar(0);
                    putchar(0);
                    putchar(0);
                    putchar(0);
                    break;
                case '~':
                    if (in[i+1] == '>') {
                        if (count > 0) {
                            count--;
                            tuple += pow85[count];
                            wput(tuple, count);
                            
                        }
                        c = in[i+1];
                        return;
                    }
                    System.err.println("%s: ~ without > in ascii85 section\n");
                    System.exit(1);
                case '\n':
                case '\r':
                case '\t':
                case ' ':
                case '\0':
                case '\f':
                case '\b':
                case 0177:
                    break;
     
                }
                i++;
            }
            
            
        }
        
        private void putchar(int l) throws IOException {
            // System.out.write(l);
            fos.write(l);
        }
    }
     

Ähnliche Themen

  1. Bildanzeige bei Dropdownauswahl?
    Von louS im Forum Javascript & Ajax
    Antworten: 13
    Letzter Beitrag: 09.11.07, 17:20
  2. Problemmit dem Subdomainscript
    Von vip3r im Forum PHP
    Antworten: 6
    Letzter Beitrag: 10.09.07, 16:40
  3. zufällige Bildanzeige
    Von rundes kipfal im Forum Flash Plattform
    Antworten: 5
    Letzter Beitrag: 06.02.06, 23:46
  4. Probleme bei Bildanzeige
    Von Benzol im Forum Javascript & Ajax
    Antworten: 4
    Letzter Beitrag: 17.07.05, 17:59
  5. Problemmit NN im Frameset Reload bei ISO-CODE -9
    Von scanline im Forum HTML & XHTML
    Antworten: 0
    Letzter Beitrag: 06.01.03, 21:52