diff --git a/docs/changelog.md b/docs/changelog.md index e2cd8e4d..67fe65ce 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,6 +6,8 @@ Requires libvips v8.7.0. #### v0.21.2 - TBD +* Ensure all metadata is removed from PNG output unless `withMetadata` used. + * Ensure shortest edge is at least one pixel after resizing. [#1003](https://github.com/lovell/sharp/issues/1003) diff --git a/src/pipeline.cc b/src/pipeline.cc index a0d3d615..b43b1c0c 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -735,11 +735,8 @@ class PipelineWorker : public Nan::AsyncWorker { (inputImageType == ImageType::PNG || inputImageType == ImageType::GIF || inputImageType == ImageType::SVG))) { // Write PNG to buffer sharp::AssertImageTypeDimensions(image, ImageType::PNG); - // Strip profile - if (!baton->withMetadata) { - vips_image_remove(image.get_image(), VIPS_META_ICC_NAME); - } VipsArea *area = VIPS_AREA(image.pngsave_buffer(VImage::option() + ->set("strip", !baton->withMetadata) ->set("interlace", baton->pngProgressive) ->set("compression", baton->pngCompressionLevel) ->set("filter", baton->pngAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_ALL : VIPS_FOREIGN_PNG_FILTER_NONE))); @@ -848,11 +845,8 @@ class PipelineWorker : public Nan::AsyncWorker { (inputImageType == ImageType::PNG || inputImageType == ImageType::GIF || inputImageType == ImageType::SVG))) { // Write PNG to file sharp::AssertImageTypeDimensions(image, ImageType::PNG); - // Strip profile - if (!baton->withMetadata) { - vips_image_remove(image.get_image(), VIPS_META_ICC_NAME); - } image.pngsave(const_cast(baton->fileOut.data()), VImage::option() + ->set("strip", !baton->withMetadata) ->set("interlace", baton->pngProgressive) ->set("compression", baton->pngCompressionLevel) ->set("filter", baton->pngAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_ALL : VIPS_FOREIGN_PNG_FILTER_NONE));