mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
Adding support for TIFF save.
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
parent
190fe92e28
commit
dcd91c85e0
3 changed files with 62 additions and 18 deletions
22
vips_test.go
22
vips_test.go
|
|
@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue