From 6765b8e026d71b3156842361d350fb7bb2d63c9c Mon Sep 17 00:00:00 2001 From: Brian Crowell Date: Wed, 24 Oct 2012 08:25:00 -0500 Subject: [PATCH] py3k: Add .FLI sanity check, and fix palette bytes bug --- Images/lena.fli | Bin 0 -> 16371 bytes PIL/FliImagePlugin.py | 2 +- Tests/test_file_fli.py | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 Images/lena.fli create mode 100644 Tests/test_file_fli.py diff --git a/Images/lena.fli b/Images/lena.fli new file mode 100644 index 0000000000000000000000000000000000000000..2c7367e229f04610bc7790b1d6f5d147b7b4b922 GIT binary patch literal 16371 zcmbumd010f*8eN+6Xr050^1N`2>~Sv$WSVZjP(kbD4<}2jA8)_C{rUMgCHH7F<3-E zpp+sslLBff^B_p`mN)<^f&-|aQ6^=c0^zO`)b75&d;hr4Ex@XJ9yy=$UDIBB?VV|p zHER?qMAn>xFYz^K&89W~|Nc4m|MAyDfxkGh_WN&1qBU!yNOV26+lf*70ftrzR}qUYKKPq<8MwoT>;9ZdCNO$e^Ng=}*pjJdSpI9&Obgh%Xkf)uCj`}ANUBTpt4fS2 zNi4pZl>9v5__M^Y{)A%#2~Gn^9s`N~FH?Vc#ddzh_IR3h^3lbpR~HX;UJPr#boPHa zQGM)Ftr>r7PfvV$$*Vmx=wU|qz0Aa>tn8)p+S7q>2dEYEsY znf>XHzYp9lcw3b|c<088nxeVN=x0r(pBiI^n-Ul5Qb(F{hVNz!H5Cptbi8lL9k^Gx zc=w+l|8?ul{mKvjTl?Zs&1^^NcxTpJd(-m6oG*`WEj{GUJ-W5@sN_pm3BN0M>ghju z&s*l6w=BHKpY46be|>lH<1?q-Yu3oFQO4>;Yq5t*d6BLz1XsSNr@vn$mMqFzOis>D z&dx@u1hz!-N;Z}(&Yor^Bm@Sz1}5Y*G}NIg@mhX;?e&+FXnwZrNHE(oConB02C-*T zPo*X&vs{CED}VU@YzC9yy6A>KI}#-mSfcn7Q!(L_3CUvY2^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