Adding support for TIFF save.

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
Yoan Blanc 2016-11-13 17:57:58 +01:00
parent 190fe92e28
commit dcd91c85e0
No known key found for this signature in database
GPG key ID: 6058CF4574298812
3 changed files with 62 additions and 18 deletions

View file

@ -45,20 +45,16 @@ func TestVipsSave(t *testing.T) {
}
}
func TestVipsCannotSave(t *testing.T) {
types := [...]ImageType{GIF, MAGICK, PDF, SVG, TIFF}
func TestVipsSaveTiff(t *testing.T) {
if !VipsIsTypeSupportedSave(TIFF) {
t.Skipf("Format %#v is not supported", ImageTypes[TIFF])
}
image, _, _ := vipsRead(readImage("test.jpg"))
options := vipsSaveOptions{Quality: 95, Type: TIFF}
buf, _ := vipsSave(image, options)
for _, typ := range types {
image, _, _ := vipsRead(readImage("test.jpg"))
options := vipsSaveOptions{Quality: 95, Type: typ}
buf, err := vipsSave(image, options)
if err == nil {
t.Fatalf("Format '%v' shouldn't be supported", ImageTypes[typ])
}
if len(buf) != 0 {
t.Fatalf("'%v' image is not empty", ImageTypes[typ])
}
if len(buf) == 0 {
t.Fatalf("Empty saved '%v' image", ImageTypes[TIFF])
}
}