diff --git a/CHANGELOG.md b/CHANGELOG.md index 17cf0ea..dfed9ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## HEAD + +* [vips] Make `#remove` that's used for removing image metadata chainable (@janko-m) + ## 1.7.0 (2018-09-20) * [vips] `#rotate` now always calls `vips_similarity()` and forwards all options to it (@janko-m) diff --git a/doc/vips.md b/doc/vips.md index 5b4e6c0..a397ee7 100644 --- a/doc/vips.md +++ b/doc/vips.md @@ -264,6 +264,7 @@ ImageProcessing::Vips .crop(0, 0, 300, 300) .invert .set("icc-profile-data", custom_profile) + .remove("xmp-data") .gaussblur(2) # ... ``` diff --git a/lib/image_processing/vips.rb b/lib/image_processing/vips.rb index a310d96..7206cde 100644 --- a/lib/image_processing/vips.rb +++ b/lib/image_processing/vips.rb @@ -112,10 +112,11 @@ module ImageProcessing image.composite(overlay, mode, **options) end - # make Vips::Image#set, #set_type, and #set_value chainable + # make Vips::Image#set, #set_type, #set_value, and #move chainable def set(*args) image.tap { |img| img.set(*args) } end def set_type(*args) image.tap { |img| img.set_type(*args) } end def set_value(*args) image.tap { |img| img.set_value(*args) } end + def remove(*args) image.tap { |img| img.remove(*args) } end private diff --git a/test/vips_test.rb b/test/vips_test.rb index 0584b95..5e3f616 100644 --- a/test/vips_test.rb +++ b/test/vips_test.rb @@ -30,13 +30,18 @@ describe "ImageProcessing::Vips" do assert_similar expected, actual end - it "applies setting metadata" do + it "allows changing metadata" do image = ImageProcessing::Vips .copy .set("icc-profile-data", "foobar") + .set_type(Vips::BLOB_TYPE, "foo", "bar") + .remove("exif-data") .call(@portrait, save: false) assert_equal "foobar", image.get("icc-profile-data") + assert_equal "bar", image.get("foo") + + assert_raises(Vips::Error) { image.get("exif-data") } end it "applies format" do