File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ local vips = require " vips"
2
+ local ffi = require " ffi"
3
+
4
+ local JPEG_FILE = " ./spec/images/Gugg_coloured.jpg"
5
+ -- test gvalue
6
+ describe (" test connection" , function ()
7
+
8
+ setup (function ()
9
+ -- vips.log.enable(true)
10
+ end )
11
+
12
+ describe (" to file target" , function ()
13
+ it (" can create image from file source and write to file target" , function ()
14
+ local source = vips .Source .new_from_file (JPEG_FILE )
15
+ local image = vips .Image .new_from_source (source , ' ' , { access = ' sequential' })
16
+ local filename = ffi .os == " Windows" and os.getenv (" TMP" ) .. " \\ x.png" or " /tmp/x.png"
17
+ local target = vips .Target .new_to_file (filename )
18
+ image :write_to_target (target , ' .png' )
19
+
20
+ local image1 = vips .Image .new_from_file (JPEG_FILE , { access = ' sequential' })
21
+ local image2 = vips .Image .new_from_file (filename , { access = ' sequential' })
22
+ assert .is_true ((image1 - image2 ):abs ():max () < 10 )
23
+ end )
24
+ end )
25
+ end )
You can’t perform that action at this time.
0 commit comments