8000 just a few failures left · libvips/pyvips@d91b193 · GitHub
[go: up one dir, main page]

Skip to content

Commit d91b193

Browse files
committed
just a few failures left
Interpolate still needs doing
1 parent 327da33 commit d91b193

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

pyvips/base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
5050
int vips_leak_set (int leak);
5151
52+
char* vips_path_filename7 (const char* path);
53+
char* vips_path_mode7 (const char* path);
54+
5255
''')
5356

5457
class Error(Exception):
@@ -86,5 +89,11 @@ def leak_set(leak):
8689
def type_find(basename, nickname):
8790
return vips_lib.vips_type_find(basename, nickname)
8891

92+
def path_filename7(filename):
93+
return ffi.string(vips_lib.vips_path_filename7(filename))
94+
95+
def path_mode7(filename):
96+
return ffi.string(vips_lib.vips_path_mode7(filename))
97+
8998
__all__ = ['ffi', 'g_free_callback', 'vips_lib', 'gobject_lib', 'Error',
9099
'leak_set', 'type_find']

pyvips/tests/test_foreign.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def jpeg_valid(self, im):
139139

140140
# see if we have exif parsing: our test image has this field
141141
x = pyvips.Image.new_from_file(JPEG_FILE)
142-
if x.get_typeof("exif-ifd0-Orientation") != GObject.TYPE_INVALID:
142+
if x.get_typeof("exif-ifd0-Orientation") != 0:
143143
# we need a copy of the image to set the new metadata on
144144
# otherwise we get caching problems
145145
x = pyvips.Image.new_from_file(JPEG_FILE)
@@ -328,10 +328,10 @@ def gif_valid(self, im):
328328
self.assertEqual(im.bands, 4)
329329

330330
# density should change size of generated svg
331-
im = pyvips.Image.magickload(SVG_FILE, density = 100)
331+
im = pyvips.Image.magickload(SVG_FILE, density = '100')
332332
width = im.width
333333
height = im.height
334-
im = pyvips.Image.magickload(SVG_FILE, density = 200)
334+
im = pyvips.Image.magickload(SVG_FILE, density = '200')
335335
# This seems to fail on travis, no idea why, some problem in their IM
336336
# perhaps
337337
#self.assertEqual(im.width, width * 2)
@@ -396,7 +396,7 @@ def webp_valid(self, im):
396396
# can do it, our webp supports metadata load/save
397397
buf = self.colour.webpsave_buffer()
398398
im = pyvips.Image.new_from_buffer(buf, "")
399-
if im.get_typeof("icc-profile-data") != GObject.TYPE_INVALID:
399+
if im.get_typeof("icc-profile-data") != 0:
400400
# verify that the profile comes back unharmed
401401
p1 = self.colour.get_value("icc-profile-data")
402402
p2 = im.get_value("icc-profile-data")

pyvips/vimage.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
char* vips_filename_get_filename (const char* vips_filename);
3737
char* vips_filename_get_options (const char* vips_filename);
3838
39+
VipsImage* vips_image_new_temp_file (const char* format);
40+
41+
int vips_image_write (VipsImage* image, VipsImage* out);
42+
3943
''')
4044

4145
# either a single number, or a table of numbers
@@ -155,7 +159,7 @@ def new_from_buffer(data, options, **kwargs):
155159
raise Error('unable to load from buffer')
156160

157161
return Operation.call(ffi.string(name), data,
158-
string_options = ffi.string(options), **kwargs)
162+
string_options = options, **kwargs)
159163

160164
@staticmethod
161165
def new_from_array(array, scale = 1.0, offset = 0.0):
@@ -179,6 +183,13 @@ def new_from_array(array, scale = 1.0, offset = 0.0):
179183

180184
return image
181185

186+
@staticmethod
187+
def new_temp_file(format):
188+
vi = vips_lib.vips_image_new_temp_file(format)
189+
image = Image(vi)
190+
191+
return image
192+
182193
def new_from_image(self, value):
183194
pixel = (Image.black(1, 1) + value).cast(self.format)
184195
image = pixel.embed(0, 0, self.width, self.height,
@@ -219,6 +230,11 @@ def write_to_buffer(self, format_string, **kwargs):
219230
return Operation.call(ffi.string(name), self,
220231
string_options = ffi.string(options), **kwargs)
221232

233+
def write(self, other):
234+
result = vips_lib.vips_image_write(self.pointer, other.pointer)
235+
if result != 0:
236+
raise Error('unable to write to image')
237+
222238
# get/set metadata
223239

224240
def get_typeof(self, name):

0 commit comments

Comments
 (0)
0