diff --git a/fixtures/test_gif.jpg b/fixtures/test_gif.jpg index 9dd2def..e69de29 100644 Binary files a/fixtures/test_gif.jpg and b/fixtures/test_gif.jpg differ diff --git a/fixtures/test_pdf.jpg b/fixtures/test_pdf.jpg index 8625743..e69de29 100644 Binary files a/fixtures/test_pdf.jpg and b/fixtures/test_pdf.jpg differ diff --git a/fixtures/test_svg.jpg b/fixtures/test_svg.jpg index cf88931..e69de29 100644 Binary files a/fixtures/test_svg.jpg and b/fixtures/test_svg.jpg differ diff --git a/image_test.go b/image_test.go index 0726fae..7f805b0 100644 --- a/image_test.go +++ b/image_test.go @@ -42,42 +42,48 @@ func TestImageSvgResize(t *testing.T) { } func TestImageGifToJpeg(t *testing.T) { - i := initImage("test.gif") - options := Options{ - Type: JPEG, - } - buf, err := i.Process(options) - if err != nil { - t.Errorf("Cannot process the image: %#v", err) - } + if VipsMinorVersion >= 8 && VipsMinorVersion > 2 { + i := initImage("test.gif") + options := Options{ + Type: JPEG, + } + buf, err := i.Process(options) + if err != nil { + t.Errorf("Cannot process the image: %#v", err) + } - Write("fixtures/test_gif.jpg", buf) + Write("fixtures/test_gif.jpg", buf) + } } func TestImagePdfToJpeg(t *testing.T) { - i := initImage("test.pdf") - options := Options{ - Type: JPEG, - } - buf, err := i.Process(options) - if err != nil { - t.Errorf("Cannot process the image: %#v", err) - } + if VipsMinorVersion >= 8 && VipsMinorVersion > 2 { + i := initImage("test.pdf") + options := Options{ + Type: JPEG, + } + buf, err := i.Process(options) + if err != nil { + t.Errorf("Cannot process the image: %#v", err) + } - Write("fixtures/test_pdf.jpg", buf) + Write("fixtures/test_pdf.jpg", buf) + } } func TestImageSvgToJpeg(t *testing.T) { - i := initImage("test.svg") - options := Options{ - Type: JPEG, - } - buf, err := i.Process(options) - if err != nil { - t.Errorf("Cannot process the image: %#v", err) - } + if VipsMinorVersion >= 8 && VipsMinorVersion > 2 { + i := initImage("test.svg") + options := Options{ + Type: JPEG, + } + buf, err := i.Process(options) + if err != nil { + t.Errorf("Cannot process the image: %#v", err) + } - Write("fixtures/test_svg.jpg", buf) + Write("fixtures/test_svg.jpg", buf) + } } func TestImageResizeAndCrop(t *testing.T) { diff --git a/vips.go b/vips.go index 0e25fba..0f369a5 100644 --- a/vips.go +++ b/vips.go @@ -24,6 +24,12 @@ var debug = d.Debug("bimg") // VipsVersion exposes the current libvips semantic version const VipsVersion = string(C.VIPS_VERSION) +// VipsMajorVersion exposes the current libvips major version number +const VipsMajorVersion = string(C.VIPS_MAJOR_VERSION) + +// VipsMinorVersion exposes the current libvips minor version number +const VipsMinorVersion = int(C.VIPS_MINOR_VERSION) + // HasMagickSupport exposes if the current libvips compilation // supports libmagick bindings. const HasMagickSupport = int(C.VIPS_MAGICK_SUPPORT) == 1