From a2e01c513b3aaa10be62d2dee8dd2af25bdf0e9c Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 4 Nov 2012 16:16:02 +0100 Subject: [PATCH] Start of images package and EXIF test files. Change-Id: Ie623ddc7f6df5cbde890a7c0a47affe91780534b --- pkg/images/images.go | 50 ++++++++++++++++++++++++++++++++ pkg/images/testdata/f1-exif.jpg | Bin 0 -> 992 bytes pkg/images/testdata/f1.jpg | Bin 0 -> 770 bytes pkg/images/testdata/f2-exif.jpg | Bin 0 -> 994 bytes pkg/images/testdata/f2.jpg | Bin 0 -> 772 bytes pkg/images/testdata/f3-exif.jpg | Bin 0 -> 992 bytes pkg/images/testdata/f3.jpg | Bin 0 -> 770 bytes pkg/images/testdata/f4-exif.jpg | Bin 0 -> 994 bytes pkg/images/testdata/f4.jpg | Bin 0 -> 772 bytes pkg/images/testdata/f5-exif.jpg | Bin 0 -> 980 bytes pkg/images/testdata/f5.jpg | Bin 0 -> 758 bytes pkg/images/testdata/f6-exif.jpg | Bin 0 -> 982 bytes pkg/images/testdata/f6.jpg | Bin 0 -> 760 bytes pkg/images/testdata/f7-exif.jpg | Bin 0 -> 980 bytes pkg/images/testdata/f7.jpg | Bin 0 -> 758 bytes pkg/images/testdata/f8-exif.jpg | Bin 0 -> 982 bytes pkg/images/testdata/f8.jpg | Bin 0 -> 760 bytes 17 files changed, 50 insertions(+) create mode 100644 pkg/images/images.go create mode 100644 pkg/images/testdata/f1-exif.jpg create mode 100644 pkg/images/testdata/f1.jpg create mode 100644 pkg/images/testdata/f2-exif.jpg create mode 100644 pkg/images/testdata/f2.jpg create mode 100644 pkg/images/testdata/f3-exif.jpg create mode 100644 pkg/images/testdata/f3.jpg create mode 100644 pkg/images/testdata/f4-exif.jpg create mode 100644 pkg/images/testdata/f4.jpg create mode 100644 pkg/images/testdata/f5-exif.jpg create mode 100644 pkg/images/testdata/f5.jpg create mode 100644 pkg/images/testdata/f6-exif.jpg create mode 100644 pkg/images/testdata/f6.jpg create mode 100644 pkg/images/testdata/f7-exif.jpg create mode 100644 pkg/images/testdata/f7.jpg create mode 100644 pkg/images/testdata/f8-exif.jpg create mode 100644 pkg/images/testdata/f8.jpg diff --git a/pkg/images/images.go b/pkg/images/images.go new file mode 100644 index 000000000..f9e0b970c --- /dev/null +++ b/pkg/images/images.go @@ -0,0 +1,50 @@ +/* +Copyright 2012 Google Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package images + +import ( + "image" + "io" + + _ "image/gif" + _ "image/jpeg" + _ "image/png" +) + +type DecodeOpts struct { + // Rotate specifies how to rotate the image. + // If nil, the image is rotated automatically based on EXIF metadata. + // If an int, Rotate is the number of degrees to rotate + // counter clockwise and must be one of 0, 90, -90, 180, or + // -180. + Rotate interface{} + + // MaxWidgth and MaxHeight optionally specify bounds on the + // final image's size. + MaxWidth, MaxHeight int + + // TODO: consider alternate options if scaled ratio doesn't + // match original ratio: + // Crop bool + // Stretch bool +} + +// Decode decodes an image from r using the provided decoding options. +// If opts is nil, the defaults are used. +func Decode(r io.Reader, opts *DecodeOpts) (image.Image, error) { + panic("TODO(mpl): implement") +} diff --git a/pkg/images/testdata/f1-exif.jpg b/pkg/images/testdata/f1-exif.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ff003e394915961ec2576628bf882b6b49a3407d GIT binary patch literal 992 zcmbV~Nl+6(6oy|<&txVu31pHY9z;cv6SzZJj6F#Vr6=@Fzv;hv-s?Bt>()lK33!#)nV;DAL|z(gVP07?KRqyehY@~Cb=&PWVJVpJe+kcfLJ+hT5q2k1y{JDGJWBu;h> z&#J7bZbfm+u0%Q0?NZ&c3Sc+_z>)}BRu#Dmg*Bou1b(k8vK&C+Dw+lmprTbEfEP8{ z1GLv*Db6p-2ZRu*NvdlLV9WK^R{3gc68#=uePTgTNvZY{asgA6K8Vp|FdW0sG{dv3 zfiv+YlfVmtImT)+$A~e4U~yPPn`F1!O|fzD4k_L$*(H4wgh>v~7#YSWnFX`-&!*i1 zk%LljVk813A}k_p7*>#`F$6)Uh#2Vz%@|nD$O|N3&;k^~n4+=%*CcwM-Z5HatVv3? z!B$qqCO1lIYgZ4Kk~1)5FCUpn&8YUa8F@!s{IZ0!m8+bq(_NWs)~;Lc&fSogUr<<7 zym3>-=E^Nwx9zB@t=n1eY1rl4y~p3Qw|W18gY6xM4tE|scD(z<$y2A#^qxI;{=&t+ z{@|s{R|cmZ z=5;P|jA5)O*FOC6GNxpd&)BQI zBfKNkHIX)}qlL(p2G;gpWKpn1u5mD7L=F#&kOe=30jh-uC%L9AS;5YT=x&CEU}%kp hg^DRW-xrR;bCn?x`WQR8eTgZt)4kyuf2L?-zW}!h3XT8( literal 0 HcmV?d00001 diff --git a/pkg/images/testdata/f1.jpg b/pkg/images/testdata/f1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e5ecc08482555d4980f59671257059c9a7abef89 GIT binary patch literal 770 zcmex=LJ%Z3brsW+o;O z0s6Oj-S z5fuR$!pIEN!@|nR%E~Fi%grl7GWdUhL6CzXfI)+qQILU2kdaxC@&6G9c?JeXR-hL^ zzJLNoCZHSH*f}`4xPc0`3NSD+GBY!=FoRqTR9y>{XJ8Rz6;d>GWD^cdWLGK_F>0K+ zkVDyN<3Z7&iyu^slZu)+xx~aJB&Af<)HO7bPj7;S~%q+;ls%Xe2zfvV;IO#p8*_6Gm} literal 0 HcmV?d00001 diff --git a/pkg/images/testdata/f2-exif.jpg b/pkg/images/testdata/f2-exif.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7e0f170e36674d695e53c5b480e57d59ca2ecab9 GIT binary patch literal 994 zcmbW0OHk8L6o${uO`0@mp=r~CxR9q-R!Jy6x?uo$&M*TgqAr}F0#bHVw8)GzfC|b= zRD7)pzOXw~e62+Bxx*)*3#+2Y3Vg#j#2Z?R!%94JPwqb_=iHO;+=(`#h2V8wleZS2 zqy*9dfCCm;0TYFQB98=M<~4u^EsyGYYh?M8CJOF0r7fq*QwaxqvB3U&Ls#7>;3Rn&Da2 zz?pcHN#F&+9AmYZW5gIiusAHDO|skVrr5Z6hZJv>?2>*6!lZ^~j0|Ix%z{~3vT3(L zPiM2#ZJ?f)!+F3_;K-B1R@cGX|D3@&ZX1umFWHrf95xHObzmPmC5BYm$;} zu$5J@$qka)+SS9Q@wy=Tvzzi_ed zQtxK+R8~eT|NDS#*~cmDZ9rv z%sWzDp|oioZJzAkz}o(cEDE;3H3lY3{v8pEkOjYj0jh-uCj??Adn00edrMZZQ;$(C fS>4Sr7o3+o%vDU_*}h10i6x{5o~c~aMH~GM?`I42 literal 0 HcmV?d00001 diff --git a/pkg/images/testdata/f2.jpg b/pkg/images/testdata/f2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bc3e1dba386b381d7f7917effecb54ce05d48849 GIT binary patch literal 772 zcmex=LJ%Z3brsW+o;O z0s6Oj-S z5fuR$!pIEN!@|nR%E~Fi%grl7GWdUhL6CzXfI)+qQILU2kdaxC@&6G9c?JeXR-hL^ zzJLNoCZHSH*f}`4xPc0`3NSD+GBY!=FoRqTR9y>{XJ8Rz6;d>GWD^cdWLGK_F>0K+ zkVDyN<3Z7&iyu^slZu)+xx~aJB&Af<)HO7bPj7;S~%q+;ls%Xe2risYLlKV(WCe-L0ObmuBY+M+(4pLRvKx^{Ci$|k ztFof{6vZcdW92lTSM{Z;0G6WwEOF4Xs>oevK_d!-_V-+oWzGCIK)Mc~QQ<0};YCgE z0R1gE3Ucyu03k$blIr?AxUvG(6%Ex@v5o$Q+SuIu!Xo`OWC5lqW00W9U^s@MX@+N6 z3uohPHh~uedxX3WGm$fN7CpRy@ zpmcNDmh!FJw(qQ}uGv-VuiM?QXK!QEzUBi554Cq3KGJ#Y_=)b5r%s@+0RlHT16^FdScFkd!_=lYhWkWp02v4h+W-In literal 0 HcmV?d00001 diff --git a/pkg/images/testdata/f3.jpg b/pkg/images/testdata/f3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bca977c644eb6805d1f4f74eece7baaeb61c9ae2 GIT binary patch literal 770 zcmex=LJ%Z3brsW+o;O z0s6Oj-S z5fuR$!pIEN!@|nR%E~Fi%grl7GWdUhL6CzXfI)+qQILU2kdaxC@&6G9c?JeXR-hL^ zzJLNoCZHSH*f}`4xPc0`3NSD+GBY!=FoRqTR9y>{XJ8Rz6;d>GWD^cdWLGK_F>0K+ zkVDyN<3Z7&iyu^slZu)+xx~aJB&Af<)HO7bPj7;S~%q+;ls%Xe2WB#=oa0r4QKMou$BaLI)NWUZnKP((dg1p*RoL=>dTDnJG0 zBr0yFfE(n7irYyP*Bh>Y9z;cv6SzZJjBf&l(v#Tr`prK*{krGtrw{96@G7gpR|QZ| z0LcKr1BdK@sX{>L76WWZ1C*oXVO@jV3potU(SYtCQ};8Dg*XCe^BEOr9e`HqhUHQ> z-a}7KQ8llsdKFKslIrzn-V_bMbOeB-8AQ=kr31}t#9#>gj;o3iK=WO69U#DjyFdUh zYFY#I*I>)f&dUab5ba63>T}@8^jDVERaV5-`|7G=bMgub^_P$dm|=`XjnKvNEK3M0 zaGZ&^2o{Sdh@v&ZZnH*65u#{w*(8VTbUH1OQPD0r+Acd~qX@$E3}MYIYnH8|RbH~` zw?N{d5Zo9^z(@#7NFRh1bZ9I^Feny`PK2-~jyDS;P3X4)gD_?YHvXDs?=vPwB-S3M zrkfl^Wn6r%tTlIZ@d+7y1J2^1sl=3We~VdgMMW=*Nm{wey*k;Gx@PUV_1?@4S=l+c zdHEYRm258EvUS^zipr{;)xMftb-VY}H|%ZPf8bzi+o8klM~@xvJaO{W=`-DD&z-+; zv8Ok9>GGBStJkjIxOw}|;N5%oA3S{Y_{q~}&tD9WjE=o|`)>UGhl!7q)1N+n`TFhq zkC|D6i(cbAR+#KBE;s+1(_78v>Ez+ndsY?S^EU k(mESqE*O#m%#}>w*&Z6Dd3dJu&m%@G^l?c?LOt}6Uy(TsK>z>% literal 0 HcmV?d00001 diff --git a/pkg/images/testdata/f4.jpg b/pkg/images/testdata/f4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..395385b8893ec4ce3545c0947d9be56879cf0bbf GIT binary patch literal 772 zcmex=LJ%Z3brsW+o;O z0s6Oj-S z5fuR$!pIEN!@|nR%E~Fi%grl7GWdUhL6CzXfI)+qQILU2kdaxC@&6G9c?JeXR-hL^ zzJLNoCZHSH*f}`4xPc0`3NSD+GBY!=FoRqTR9y>{XJ8Rz6;d>GWD^cdWLGK_F>0K+ zkVDyN<3Z7&iyu^slZu)+xx~aJB&Af<)HO7bPj7;S~%q+;ls%Xe2Zzy zfG2LChzM}F#hN=}fC{o8f@?{N#bNMK2i!qH4>2C=9wXX? znif#~acX+NuLsg}0NZ{59vQ5vYic{0#)P2|{(Y~hYM4w{F${n(6R84WI)gC>7%#w8 zm|Ktwgb=KWRgFpTWQVHC>#Hi`8iMsTad`zr#l|zp2FftzLSu1p0>`l|C-S^aaEK0v zBubJq%I$JS$x)Kz^0{P>;`MqR(eq+_N{n0aDrOQwF^1*r9A{UYl2iF-Gp>UyKnfI7 zA_F56Difn07Gl#llwhi`3_HSdHeRrc5)yh{zz|9qmYRQ!?Coa9SebLjYne7rNjaZT zr|8Y?okC((PoKARU@R%EBGh6Ree+`G$0jdYoU$a4~jg?i^n`(l!o9nl1ZD`!qv~$<)*0w!+_Z>KRsN?XFqsNYSoj7^w^qI5gy3b#@ z*n8>nm8;io-0Z(~`_A2a_a8ib^!Uls!J*-im#<#GdHe4DhtctmpFV&2`tAF~4^tP8 zaavYH*&JQi1j4W^WqDH%yRLX&7E1om)Cg`^kzZHYVYjnvnQsNj(ICW1EMd< zKaxCdN}E#lcfwl!OIbwNjILpDP=dpwGGxHd?l7}M#EH&6CcCG;Gdh~Ug2LJ%Z3brsW+o;O z0s6Oj-S z5fuR$!pIEN!@|nR%E~Fi%grl7GWdUhL6Cz%gCT&KQILU2kdaxC@&6G9c?JeXR-hL^ zzJLNoCZHSH*f}`4xPc0`3NSD+GBY!=FoRqTR9y>{XJ8Rz6;d>GWD^cdWLGK_F>0K+ zkVDyN<3Z7&iyu^slZu)+xx~aJB&Af<)HO7bPj7;S~%q+;ls%Xe2c7CZVZ;T4DeHCIAZW>_Gqk literal 0 HcmV?d00001 diff --git a/pkg/images/testdata/f6-exif.jpg b/pkg/images/testdata/f6-exif.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4e2c86415a65d641722ce33a98f61d5bed9da762 GIT binary patch literal 982 zcmbV}Nl+6(6oy|<&txVu31pHF1b*EtW{J2E~qyUkZ>cSAXQcgDySz> zaXSUvxuN2A62SS&VN;2q{nMtLg5)y8qX2zSqWxF%B>CTl{qZrKOMo z00QvD2^19p3r-2Z&1!&ZvM{0>NP5`AphpLsLBSDVT;Y8J(CG&@oZEq`8AUkoB(&

ECwfnwI(_Esx$}J& zE?yeAeC6u3>o;!=-M(}8-u(v;A3c8Z^x4Sh*!Zj0Z{EIp|Ka1r)Ths1zJB}uWBRAb zh0hqmije)mg-sv~%Tks%xd_vYgUT$Iq*X2qntIxsAH zQoZA8QzqIh+24V+{})*VY@TZjY?R>RQ5mw~S6?u8qIai=ZyIFgmhA3UnCXk&!E-uY XIcJTMW>%CvN`_M+mxfDZ8>7Dg!SMnV literal 0 HcmV?d00001 diff --git a/pkg/images/testdata/f6.jpg b/pkg/images/testdata/f6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..175f40239c7571fa39be2f26f4c9d157a8dc60b9 GIT binary patch literal 760 zcmex=LJ%Z3brsW+o;O z0s6Oj-S z5fuR$!pIEN!@|nR%E~Fi%grl7GWdUhL6Cz%gCT&KQILU2kdaxC@&6G9c?JeXR-hL^ zzJLNoCZHSH*f}`4xPc0`3NSD+GBY!=FoRqTR9y>{XJ8Rz6;d>GWD^cdWLGK_F>0K+ z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