Skip to content

Commit 743ebd3

Browse files
committed
ENH: Allow kwargs in generic save method
1 parent 17a1eca commit 743ebd3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nibabel/loadsave.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def guessed_image_type(filename):
7878
raise ImageFileError(f'Cannot work out file type of "{filename}"')
7979

8080

81-
def save(img, filename):
81+
def save(img, filename, **kwargs):
8282
""" Save an image to file adapting format to `filename`
8383
8484
Parameters
@@ -96,7 +96,7 @@ def save(img, filename):
9696

9797
# Save the type as expected
9898
try:
99-
img.to_filename(filename)
99+
img.to_filename(filename, **kwargs)
100100
except ImageFileError:
101101
pass
102102
else:
@@ -144,7 +144,7 @@ def save(img, filename):
144144
# Here, we either have a klass or a converted image.
145145
if converted is None:
146146
converted = klass.from_image(img)
147-
converted.to_filename(filename)
147+
converted.to_filename(filename, **kwargs)
148148

149149

150150
@deprecate_with_version('read_img_data deprecated. '

0 commit comments

Comments
 (0)