[reportlab-users] hack to ImageReader
Robin Becker
reportlab-users@reportlab.com
Wed, 17 Mar 2004 16:37:15 +0000
In article <40585993.6000904@truckport.de>, Patrick Ulmer
<ulmer@truckport.de> writes
>Hi,
>
>I'm new to reportlab and start to use it with zope. I was wondering,
>that the demo for zope doesn't work and I get the error that the method
>getRGBData() is not supported. In CVS I found out, that pdfgen/canvas.py
>changed from revision 1.116 to 1.117 comment with "hack to ImageReader"
>from rgbecker. But why switched from PIL to ImageReader and where can I
>find a example for ImageReader?
>
>I get my image from zope with PIL:
>
>PIL_Image.open(cStringIO.StringIO(str(self.fetchPreview(id=oid))))
>
>I hope that ImageReader is able to read data like PIL and not only from
>filesystem?
>
>Bye,
>
>Patrick
...... sorry for this. We moved the PIL interface internal to the
reportlab.lib.utils.ImageReader class to allow jython to get process the
images in the same way as python.
I will change the rlzope.py file to the following included version which
uses ImageReader. Can you test this and see if it works for you?
[ Section: 1/1 File: rlzope.py UUencoded by: Turnpike Integrated Version 5.01 U ]
begin 644 rlzope.py
M(R`D2&5A9&5R.B`O8W9S<F]O="]R97!O<G1L86(O<F5P;W)T;&%B+V1E;6]S
M+W)L>F]P92]R;'IO<&4N<'DL=B`Q+C4@,C`P,B\P."\R,R`Q,SHU,3HQ.2!J
M;VAN<')E8V5D;R!%>'`@)`T*(PT*(R!5<VEN9R!T:&4@4F5P;W)T3&%B('1O
M;VQK:70@9G)O;2!W:71H:6X@6F]P90T*(PT*(R!705).24Y'(#H@5&AE($UY
M4$1&1&]C(&-L87-S(&1E86QS('=I=&@@4F5P;W)T3&%B)W,@<&QA='EP=7,@
M9G)A;65W;W)K+`T*(R`@("`@("!W:&EL92!T:&4@37E086=E5&5M<&QA=&4@
M8VQA<W,@9&ER96-T;'D@9&5A;',@=VET:"!297!O<G1,86(G<PT*(R`@("`@
M("!C86YV87,L('1H:7,@=V%Y('EO=2!K;F]W(&AO=R!T;R!D;R!W:71H(&)O
M=&@N+BX-"B,-"B,@3&EC96YS92`Z('1H92!297!O<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@T*("`@("`@("`@("`@(B(B
M26YI=&EA;&ES92!O=7(@<&%G92!T96UP;&%T92XB(B(-"B`@("`@("`@("`@
M(",-"B`@("`@("`@("`@(",@=V4@;75S="!S879E(&$@<&]I;G1E<B!T;R!O
M=7(@<&%R96YT('-O;65W:&5R90T*("`@("`@("`@("`@<V5L9BYP87)E;G0@
M/2!P87)E;G0-"@T*("`@("`@("`@("`@(R!/=7(@9&]C(&ES(&UA9&4@;V8@
M82!S:6YG;&4@9G)A;64-"B`@("`@("`@("`@(&-O;G1E;G0@/2!&<F%M92@P
M+C<U("H@:6YC:"P@,"XU("H@:6YC:"P@<&%R96YT+F1O8W5M96YT+G!A9V5S
M:7IE6S!=("T@,2XR-2`J(&EN8V@L('!A<F5N="YD;V-U;65N="YP86=E<VEZ
M95LQ72`M("@Q+C4@*B!I;F-H*2D-"B`@("`@("`@("`@(%!A9V5496UP;&%T
M92Y?7VEN:71?7RAS96QF+"`B37E496UP;&%T92(L(%MC;VYT96YT72D-"@T*
M("`@("`@("`@("`@(R!G970@86QL('1H92!I;6%G97,@=V4@;F5E9"!N;W<L
M(&EN(&-A<V4@=V4G=F4@9V]T#0H@("`@("`@("`@("`C('-E=F5R86P@<&%G
M97,@=&AI<R!W:6QL('-A=F4@<V]M92!#4%4-"B`@("`@("`@("`@('-E;&8N
M;&]G;R`]('-E;&8N9V5T26UA9V5&<F]M6D]$0B@B;&]G;R(I#0H-"B`@("`@
M("`@9&5F(&=E=$EM86=E1G)O;5I/1$(H<V5L9BP@;F%M92D@.@T*("`@("`@
M("`@("`@(B(B4F5T<FEE=F5S(&%N($EM86=E(&9R;VT@=&AE(%I/1$(L(&-O
M;G9E<G1S(&ET('1O(%!)3"P-"B`@("`@("`@("`@("`@(&%N9"!M86ME<R!I
M="`P+C<U(&EN8V@@:&EG:"X-"B`@("`@("`@("`@("(B(@T*("`@("`@("`@
M("`@=')Y(#H-"B`@("`@("`@("`@("`@("`C('1R>2!T;R!G970@:70@9G)O
M;2!:3T1"#0H@("`@("`@("`@("`@("`@;&]G;R`](&=E=&%T='(H<V5L9BYP
M87)E;G0N8V]N=&5X="P@;F%M92D-"B`@("`@("`@("`@(&5X8V5P="!!='1R
M:6)U=&5%<G)O<B`Z#0H@("`@("`@("`@("`@("`@(R!N;W0@9F]U;F0@(0T*
M("`@("`@("`@("`@("`@(')E='5R;B!.;VYE#0H-"B`@("`@("`@("`@(",@
M0V]N=F5R="!I="!T;R!024P-"B`@("`@("`@("`@(&EM86=E(#T@26UA9V52
M96%D97(H8U-T<FEN9TE/+E-T<FEN9TE/*'-T<BAL;V=O+F1A=&$I*2D-"B`@
M("`@("`@("`@("AW:61T:"P@:&5I9VAT*2`](&EM86=E+F=E=%-I>F4H*0T*
M#0H@("`@("`@("`@("`C('-C86QE(&ET('1O(&)E(#`N-S4@:6YC:"!H:6=H
M#0H@("`@("`@("`@("!M=6QT:2`]("@H:&5I9VAT("L@,"XP*2`O("@P+C<U
M("H@:6YC:"DI#0H@("`@("`@("`@("!W:61T:"`](&EN="AW:61T:"`O(&UU
M;'1I*0T*("`@("`@("`@("`@:&5I9VAT(#T@:6YT*&AE:6=H="`O(&UU;'1I
M*0T*#0H@("`@("`@("`@("!R971U<FX@*"AW:61T:"P@:&5I9VAT*2P@:6UA
M9V4I#0H-"B`@("`@("`@9&5F(&)E9F]R941R87=086=E*'-E;&8L(&-A;G9A
M<RP@9&]C*2`Z#0H@("`@("`@("`@("`B(B)$<F%W<R!A(&QO9V\@86YD(&%N
M(&-O;G1R:6)U=&EO;B!M97-S86=E(&]N(&5A8V@@<&%G92XB(B(-"B`@("`@
M("`@("`@(&-A;G9A<RYS879E4W1A=&4H*0T*("`@("`@("`@("`@:68@<V5L
M9BYL;V=O(&ES(&YO="!.;VYE(#H-"B`@("`@("`@("`@("`@("`C(&1R87=S
M('1H92!L;V=O(&EF(&ET(&5X:7-T<PT*("`@("`@("`@("`@("`@("@H=VED
M=&@L(&AE:6=H="DL(&EM86=E*2`]('-E;&8N;&]G;PT*("`@("`@("`@("`@
M("`@(&-A;G9A<RYD<F%W26UA9V4H:6UA9V4L(&EN8V@L(&1O8RYP86=E<VEZ
M95LQ72`M(&EN8V@L('=I9'1H+"!H96EG:'0I#0H@("`@("`@("`@("!C86YV
M87,N<V5T1F]N="@G5&EM97,M4F]M86XG+"`Q,"D-"B`@("`@("`@("`@(&-A
M;G9A<RYD<F%W0V5N=')E9%-T<FEN9RAI;F-H("L@*&1O8RYP86=E<VEZ95LP
M72`M("@Q+C4@*B!I;F-H*2D@+R`R+"`P+C(U("H@:6YC:"P@(D-O;G1R:6)U
M=&5D(&)Y($IE<F]M92!!;&5T("T@86QE=$!U;FEC92YF<B(I#0H@("`@("`@
M("`@("!C86YV87,N<F5S=&]R95-T871E*"D-"@T*("`@(&1E9B!?7VEN:71?
M7RAS96QF+"!C;VYT97AT+"!F:6QE;F%M92D@.@T*("`@("`@("`C('-A=F4@
M<V]M92!D871A<PT*("`@("`@("!S96QF+F-O;G1E>'0@/2!C;VYT97AT#0H@
M("`@("`@('-E;&8N8G5I;'0@/2`P#0H@("`@("`@('-E;&8N;V)J96-T<R`]
M(%M=#0H-"B`@("`@("`@(R!W92!W:6QL(&)U:6QD(&%N(&EN+6UE;6]R>2!D
M;V-U;65N=`T*("`@("`@("`C(&EN<W1E860@;V8@8W)E871I;F<@86X@;VXM
M9&ES:R!F:6QE+@T*("`@("`@("!S96QF+G)E<&]R="`](&-3=')I;F=)3RY3
M=')I;F=)3R@I#0H-"B`@("`@("`@(R!I;FET:6%L:7-E(&$@4$1&(&1O8W5M
M96YT('5S:6YG(%)E<&]R=$QA8B=S('!L871Y<'5S#0H@("`@("`@('-E;&8N
M9&]C=6UE;G0@/2!"87-E1&]C5&5M<&QA=&4H<V5L9BYR97!O<G0I#0H-"B`@
M("`@("`@(R!A9&0@;W5R('!A9V4@=&5M<&QA=&4-"B`@("`@("`@(R`H=V4@
M8V]U;&0@861D(&UO<F4@=&AA;B!O;F4L(&)U="!)('!R969E<B!T;R!K965P
M(&ET('-I;7!L92D-"B`@("`@("`@<V5L9BYD;V-U;65N="YA9&1086=E5&5M
M<&QA=&5S*'-E;&8N37E086=E5&5M<&QA=&4H<V5L9BDI#0H-"B`@("`@("`@
M(R!G970@=&AE(&1E9F%U;'0@<W1Y;&4@<VAE971S#0H@("`@("`@('-E;&8N
M4W1Y;&53:&5E="`]('-T>6QE<RYG971386UP;&53='EL95-H965T*"D-"@T*
M("`@("`@("`C('1H96X@8G5I;&0@82!S:6UP;&4@9&]C('=I=&@@4F5P;W)T
M3&%B)W,@<&QA='EP=7,-"B`@("`@("`@<V]M971E>'0@/2`B02!S86UP;&4@
M<V-R:7!T('1O('-H;W<@:&]W('1O('5S92!297!O<G1,86(@9G)O;2!W:71H
M:6X@6F]P92(-"B`@("`@("`@=7)L(#T@<V5L9BYE<V-A<&5X;6PH8V]N=&5X
M="YA8G-O;'5T95]U<FPH*2D-"B`@("`@("`@=7)L9FEL96YA;64@/2!S96QF
M+F5S8V%P97AM;"AC;VYT97AT+F%B<V]L=71E7W5R;"@I("L@)R\E<R<@)2!F
M:6QE;F%M92D-"B`@("`@("`@<V5L9BYA<'!E;F0H4&%R86=R87!H*")5<VEN
M9R!297!O<G1,86(@9G)O;2!W:71H:6X@6F]P92(L('-E;&8N4W1Y;&53:&5E
M=%LB2&5A9&EN9S,B72DI#0H@("`@("`@('-E;&8N87!P96YD*%-P86-E<B@P
M+"`Q,"DI#0H@("`@("`@('-E;&8N87!P96YD*%!A<F%G<F%P:"@B66]U(&QA
M=6YC:&5D(&ET(&9R;VT@.B`E<R(@)2!U<FPL('-E;&8N4W1Y;&53:&5E=%LG
M3F]R;6%L)UTI*0T*("`@("`@("!S96QF+F%P<&5N9"A3<&%C97(H,"P@-#`I
M*0T*("`@("`@("!S96QF+F%P<&5N9"A087)A9W)A<&@H(DEF('!O<W-I8FQE
M+"!T:&ES(')E<&]R="!W:6QL(&)E(&%U=&]M871I8V%L;'D@<V%V960@87,@
M.B`E<R(@)2!U<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)N86P@;65T:&]D('1O('-H;W<@<&5O<&QE(&AO
M=R!T;R!U<V4@4F5P;W)T3&%B(&9R;VT@=VET:&EN(%IO<&4N(B(B#0H@("`@
M=')Y.@T*("`@("`@("`C#0H@("`@("`@(",@=VAI8V@@9FEL92]O8FIE8W0@
M;F%M92!T;R!U<V4@/PT*("`@("`@("`C(&%P<&5N9"`_;F%M93UX>'AX>"!T
M;R!R;'IO<&4G<R!U<FP@=&\-"B`@("`@("`@(R!C:&]O<V4@86YO=&AE<B!N
M86UE#0H@("`@("`@(&9I;&5N86UE(#T@<V5L9BY215%515-4+F=E="@B;F%M
M92(L(")D=6UM>2YP9&8B*0T*("`@("`@("!I9B!F:6QE;F%M95LM-#I=("$]
M("<N<&1F)R`Z#0H@("`@("`@("`@("!F:6QE;F%M92`](&9I;&5N86UE("L@
M)RYP9&8G#0H-"B`@("`@("`@(R!T96QL('1H92!B<F]W<V5R('=E('-E;F0@
M<V]M92!01$8@9&]C=6UE;G0-"B`@("`@("`@(R!W:71H('1H92!R97%U97-T
M960@9FEL96YA;64-"@T*("`@("`@("`C(&=E="!T:&4@9&]C=6UE;G0G<R!C
M;VYT96YT(&ET<V5L9B!A<R!A('-T<FEN9R!O9B!T97AT#0H@("`@("`@(&-O
M;G1E;G0@/2!S='(H37E01$9$;V,H<V5L9BP@9FEL96YA;64I*0T*#0H@("`@
M("`@(",@=V4@=VEL;"!R971U<FX@:70@=&\@=&AE(&)R;W=S97(L(&)U="!B
M969O<F4@=&AA="!W92!A;'-O('=A;G0@=&\-"B`@("`@("`@(R!S879E(&ET
M(&EN=&\@=&AE(%I/1$(@:6YT;R!T:&4@8W5R<F5N="!F;VQD97(-"B`@("`@
M("`@=')Y(#H-"B`@("`@("`@("`@('-E;&8N;6%N86=E7V%D9$9I;&4H:60@
M/2!F:6QE;F%M92P@9FEL92`](&-O;G1E;G0L('1I=&QE(#T@(D$@<V%M<&QE
M(%!$1B!D;V-U;65N="!P<F]D=6-E9"!W:71H(%)E<&]R=$QA8B(L('!R96-O
M;F1I=&EO;B`]("<G+"!C;VYT96YT7W1Y<&4@/2`B87!P;&EC871I;VXO<&1F
M(BD-"B`@("`@("`@97AC97!T(#H-"B`@("`@("`@("`@(",@:70@<V5E;7,@
M86X@;V)J96-T('=I=&@@=&AI<R!N86UE(&%L<F5A9'D@97AI<W1S(&EN('1H
M92!:3T1".@T*("`@("`@("`@("`@(R!I="=S(&UO<F4@<V5C=7)E('1O(&YO
M="!R97!L86-E(&ET+"!S:6YC92!W92!C;W5L9"!P;W-S:6)L>0T*("`@("`@
M("`@("`@(R!D97-T<F]Y(&%N(&EM<&]R=&%N="!01$8@9&]C=6UE;G0@;V8@
M=&AI<R!N86UE+@T*("`@("`@("`@("`@<&%S<PT*("`@("`@("!S96QF+E)%
M455%4U0N4D534$].4T4N<V5T2&5A9&5R*"=#;VYT96YT+51Y<&4G+"`G87!P
M;&EC871I;VXO<&1F)RD-"B`@("`@("`@<V5L9BY215%515-4+E)%4U!/3E-%
M+G-E=$AE861E<B@G0V]N=&5N="U$:7-P;W-I=&EO;B<L("=A='1A8VAM96YT
M.R!F:6QE;F%M93TE<R<@)2!F:6QE;F%M92D-"B`@("!E>&-E<'0Z#0H@("`@
M("`@(&EM<&]R="!T<F%C96)A8VLL('-Y<RP@8V=I#0H@("`@("`@(&-O;G1E
M;G0@/2!S>7,N<W1D;W5T(#T@<WES+G-T9&5R<B`](&-3=')I;F=)3RY3=')I
M;F=)3R@I#0H@("`@("`@('-E;&8N4D5154535"Y215-03TY312YS971(96%D
M97(H)T-O;G1E;G0M5'EP92<L("=T97AT+VAT;6PG*0T*("`@("`@("!T<F%C
M96)A8VLN<')I;G1?97AC*"D-"B`@("`@("`@<WES+G-T9&]U="`]('-Y<RY?
M7W-T9&]U=%]?#0H@("`@("`@('-Y<RYS=&1E<G(@/2!S>7,N7U]S=&1E<G)?
M7PT*("`@("`@("!C;VYT96YT(#T@)SQH=&UL/CQH96%D/CPO:&5A9#X\8F]D
M>3X\<')E/B5S/"]P<F4^/"]B;V1Y/CPO:'1M;#XG("4@8V=I+F5S8V%P92AC
M;VYT96YT+F=E='9A;'5E*"DI#0H-"B`@("`C('1H96X@=V4@86QS;R!R971U
M<FX@=&AE(%!$1B!C;VYT96YT('1O('1H92!B<F]W<V5R#0H@("`@<F5T=7)N
*(&-O;G1E;G0-"@``
`
end
sum -r/size 738/9840 section (from "begin" to "end")
sum -r/size 56853/7120 entire input file
--
Robin Becker