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 000000000..ff003e394 Binary files /dev/null and b/pkg/images/testdata/f1-exif.jpg differ diff --git a/pkg/images/testdata/f1.jpg b/pkg/images/testdata/f1.jpg new file mode 100644 index 000000000..e5ecc0848 Binary files /dev/null and b/pkg/images/testdata/f1.jpg differ diff --git a/pkg/images/testdata/f2-exif.jpg b/pkg/images/testdata/f2-exif.jpg new file mode 100644 index 000000000..7e0f170e3 Binary files /dev/null and b/pkg/images/testdata/f2-exif.jpg differ diff --git a/pkg/images/testdata/f2.jpg b/pkg/images/testdata/f2.jpg new file mode 100644 index 000000000..bc3e1dba3 Binary files /dev/null and b/pkg/images/testdata/f2.jpg differ diff --git a/pkg/images/testdata/f3-exif.jpg b/pkg/images/testdata/f3-exif.jpg new file mode 100644 index 000000000..3ed7b16a7 Binary files /dev/null and b/pkg/images/testdata/f3-exif.jpg differ diff --git a/pkg/images/testdata/f3.jpg b/pkg/images/testdata/f3.jpg new file mode 100644 index 000000000..bca977c64 Binary files /dev/null and b/pkg/images/testdata/f3.jpg differ diff --git a/pkg/images/testdata/f4-exif.jpg b/pkg/images/testdata/f4-exif.jpg new file mode 100644 index 000000000..0e081f919 Binary files /dev/null and b/pkg/images/testdata/f4-exif.jpg differ diff --git a/pkg/images/testdata/f4.jpg b/pkg/images/testdata/f4.jpg new file mode 100644 index 000000000..395385b88 Binary files /dev/null and b/pkg/images/testdata/f4.jpg differ diff --git a/pkg/images/testdata/f5-exif.jpg b/pkg/images/testdata/f5-exif.jpg new file mode 100644 index 000000000..e8d875479 Binary files /dev/null and b/pkg/images/testdata/f5-exif.jpg differ diff --git a/pkg/images/testdata/f5.jpg b/pkg/images/testdata/f5.jpg new file mode 100644 index 000000000..4b985b19b Binary files /dev/null and b/pkg/images/testdata/f5.jpg differ diff --git a/pkg/images/testdata/f6-exif.jpg b/pkg/images/testdata/f6-exif.jpg new file mode 100644 index 000000000..4e2c86415 Binary files /dev/null and b/pkg/images/testdata/f6-exif.jpg differ diff --git a/pkg/images/testdata/f6.jpg b/pkg/images/testdata/f6.jpg new file mode 100644 index 000000000..175f40239 Binary files /dev/null and b/pkg/images/testdata/f6.jpg differ diff --git a/pkg/images/testdata/f7-exif.jpg b/pkg/images/testdata/f7-exif.jpg new file mode 100644 index 000000000..b5dddea44 Binary files /dev/null and b/pkg/images/testdata/f7-exif.jpg differ diff --git a/pkg/images/testdata/f7.jpg b/pkg/images/testdata/f7.jpg new file mode 100644 index 000000000..b543073d2 Binary files /dev/null and b/pkg/images/testdata/f7.jpg differ diff --git a/pkg/images/testdata/f8-exif.jpg b/pkg/images/testdata/f8-exif.jpg new file mode 100644 index 000000000..fb050fc6d Binary files /dev/null and b/pkg/images/testdata/f8-exif.jpg differ diff --git a/pkg/images/testdata/f8.jpg b/pkg/images/testdata/f8.jpg new file mode 100644 index 000000000..6b1bd29fb Binary files /dev/null and b/pkg/images/testdata/f8.jpg differ