Dandyduck Geschrieben 25. Oktober 2010 Teilen Geschrieben 25. Oktober 2010 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&-2b3mf3Y*Q/q,jk2D[9"76'h!=o#B!Y,22n,Nn!!!=Q! 0.ee,0/"XS!VHHl!!E<'!"[l]rrUsd!Ug!r&'a/!k3(mej38#8mJm8&'`/UF'`J.(!"8l.+"o,p/hSe- /M8.8!!<6%!i#Yn!<2rs!2Ao^$NZFPk2tpjkND!jP3r;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s8@'?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>'e***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©) { 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 = nextChar(); if (five == '~') { if (nextChar() == '>') { break; } else { throw new PDFParseException( "Bad character in ASCII85Decode: not ~>"); } } else if (five >= '!' && five <= 'u') { five -= '!'; } else if (five == 'z') { if (i == 0) { five = 0; i = 4; } else { throw new PDFParseException( "Inappropriate 'z' in ASCII85Decode"); } } else { throw new PDFParseException( "Bad character in ASCII85Decode: " + five + " (" + (char) five + ")"); } } 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 '~>'. * * @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) { 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 Zitieren Link zu diesem Kommentar Auf anderen Seiten teilen Mehr Optionen zum Teilen...
Empfohlene Beiträge
Dein Kommentar
Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.