fix(vips): panic error on exif orientation

master
Tomas Aparicio 11 years ago
parent 4bf5d7391e
commit 6142436743

@ -2,8 +2,8 @@
Small [Go](http://golang.org) library for blazing fast and efficient image processing based on [libvips](https://github.com/jcupitt/libvips) using C bindings. It provides a clean, simple and fluent [API](https://godoc.org/github.com/h2non/bimg) in pure Go.
bimg is designed to be a small and efficient library with a generic and useful set of features.
It uses internally libvips, which requires a [low memory footprint](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use)
bimg was designed to be a small and efficient library with a generic and useful features.
It uses internally libvips, a powerful library written in C for binary image processing which requires a [low memory footprint](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use)
and it's typically 4x faster than using the quickest ImageMagick and GraphicsMagick settings or Go native `image` package, and in some cases it's even 8x faster processing JPEG images.
It can read JPEG, PNG, WEBP and TIFF formats and output to JPEG, PNG and WEBP, including conversion between them. It supports common [image operations](#supported-image-operations) such as crop, resize, rotate, zoom, watermark...
@ -230,6 +230,13 @@ if err != nil {
bimg.Write("new.jpg", newImage)
```
#### Debugging
Run the process passing the `DEBUG` environment variable
```
DEBUG=* ./app
```
#### func DetermineImageTypeName
```go

@ -47,7 +47,7 @@ func TestMetadata(t *testing.T) {
for _, file := range files {
metadata, err := Metadata(readFile(file.name))
if err != nil {
t.Fatalf("Cannot read the image: %#v", err)
t.Fatalf("Cannot read the image: %s -> %s", file.name, err)
}
if metadata.Type != file.format {

@ -68,12 +68,12 @@ vips_rotate(VipsImage *in, VipsImage **buf, int angle)
int
vips_exif_orientation(VipsImage *image) {
int orientation = 0;
const char **exif;
const char *exif;
if (
vips_image_get_typeof(image, "exif-ifd0-Orientation") != 0 &&
!vips_image_get_string(image, "exif-ifd0-Orientation", exif)
!vips_image_get_string(image, "exif-ifd0-Orientation", &exif)
) {
orientation = atoi(exif[0]);
orientation = atoi(&exif[0]);
}
return orientation;
};

Loading…
Cancel
Save