diff --git a/README.md b/README.md index ed6506f..9f060e7 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ The [install script](https://github.com/lovell/sharp/blob/master/preinstall.sh) - Enlarge - Crop - Rotate (with auto-rotate based on EXIF orientation) +- Progressive - Flip (with auto-flip based on EXIF metadata) - Flop - Zoom @@ -159,6 +160,7 @@ options := bimg.Options{ Crop: true, Quality: 95, Rotate: 180, + Interlace: 1, } buffer, err := bimg.Read("image.jpg") @@ -618,6 +620,7 @@ type Options struct { Flip bool Flop bool NoAutoRotate bool + Interlace int Rotate Angle Gravity Gravity Watermark Watermark diff --git a/options.go b/options.go index 4495a55..39b170f 100644 --- a/options.go +++ b/options.go @@ -88,6 +88,7 @@ type Options struct { Flip bool Flop bool NoAutoRotate bool + Interlace int Rotate Angle Gravity Gravity Watermark Watermark diff --git a/resize.go b/resize.go index 36bb10a..a89583c 100644 --- a/resize.go +++ b/resize.go @@ -126,6 +126,7 @@ func Resize(buf []byte, o Options) ([]byte, error) { Quality: o.Quality, Type: o.Type, Compression: o.Compression, + Interlace: o.Interlace, } // Finally save as buffer diff --git a/vips.go b/vips.go index 04bf8d6..b6cc6fe 100644 --- a/vips.go +++ b/vips.go @@ -35,6 +35,7 @@ type vipsSaveOptions struct { Quality int Compression int Type ImageType + Interlace int } type vipsWatermarkOptions struct { @@ -235,7 +236,7 @@ func vipsSave(image *C.struct__VipsImage, o vipsSaveOptions) ([]byte, error) { break default: debug("Save JPEG options: Q: %s", o.Quality) - err = C.vips_jpegsave_bridge(image, &ptr, &length, 1, C.int(o.Quality), 0) + err = C.vips_jpegsave_bridge(image, &ptr, &length, 1, C.int(o.Quality), C.int(o.Interlace)) break } diff --git a/vips_test.go b/vips_test.go index 5eab2c3..38f6fe5 100644 --- a/vips_test.go +++ b/vips_test.go @@ -30,7 +30,7 @@ func TestVipsRead(t *testing.T) { func TestVipsSave(t *testing.T) { image, _, _ := vipsRead(readImage("test.jpg")) - options := vipsSaveOptions{Quality: 95, Type: JPEG} + options := vipsSaveOptions{Quality: 95, Type: JPEG, Interlace: 1} buf, err := vipsSave(image, options) if err != nil {