diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fdacec..95f0d06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## master +## Version 2.1.4 (2021-10-27) + +* add support for `format_string`, so buffer and target savers are better at + writing the correct format [jcupitt] + ## Version 2.1.3 (2021-8-23) * fix a gtype size error on win64 [danini-the-panini] diff --git a/VERSION b/VERSION index ac2cdeb..7d2ed7c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.3 +2.1.4 diff --git a/lib/vips/image.rb b/lib/vips/image.rb index 1b800d1..6bc948b 100644 --- a/lib/vips/image.rb +++ b/lib/vips/image.rb @@ -626,7 +626,12 @@ def write_to_buffer format_string, **opts saver = Vips.vips_foreign_find_save_buffer filename raise Vips::Error if saver.nil? - buffer = Vips::Operation.call saver, [self], opts, option_string + # note the format_string for savers + image = self.mutate do |x| + x.set_type! Vips::REFSTR_TYPE, "format-string", format_string + end + + buffer = Vips::Operation.call saver, [image], opts, option_string raise Vips::Error if buffer.nil? write_gc @@ -667,7 +672,12 @@ def write_to_target target, format_string, **opts saver = Vips.vips_foreign_find_save_target filename raise Vips::Error if saver.nil? - Vips::Operation.call saver, [self, target], opts, option_string + # note the format_string for savers + image = self.mutate do |x| + x.set_type! Vips::REFSTR_TYPE, "format-string", format_string + end + + Vips::Operation.call saver, [image, target], opts, option_string write_gc end diff --git a/lib/vips/version.rb b/lib/vips/version.rb index efc5ffb..d1f9890 100644 --- a/lib/vips/version.rb +++ b/lib/vips/version.rb @@ -1,3 +1,3 @@ module Vips - VERSION = "2.1.3" + VERSION = "2.1.4" end