From 494fb41a687d6f2729339d9fd7397d690d1d8de3 Mon Sep 17 00:00:00 2001 From: Doug Felt <dougfelt@google.com> Date: Wed, 25 Jan 2017 09:16:47 -0800 Subject: [PATCH] Copy original file if pngquant can't compress it. --skip_if_larger does nothing and returns an error if pngquant would generate a larger file than the original. Formerly we would not copy the file in this case so later operations expecting the file would fail. No image triggered this, though, so the issue went unnoticed. We want the smaller of the two files. It's unclear if later compression using optipng would still do better with the larger quantized file vs the original unquantized file, but we need to have a file. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 654ff927c..48cf6dbe3 100644 --- a/Makefile +++ b/Makefile @@ -168,10 +168,10 @@ flag-symlinks: $(RESIZED_FLAG_FILES) | $(RENAMED_FLAGS_DIR) $(RENAMED_FLAG_FILES): | flag-symlinks $(QUANTIZED_DIR)/%.png: $(RENAMED_FLAGS_DIR)/%.png $(PNGQUANT) | $(QUANTIZED_DIR) - $(PNGQUANT) $(PNGQUANTFLAGS) -o "$@" "$<" + @($(PNGQUANT) $(PNGQUANTFLAGS) -o "$@" "$<"; case "$$?" in "98") cp $< $@;; *) exit "$$?";; esac) $(QUANTIZED_DIR)/%.png: $(EMOJI_DIR)/%.png $(PNGQUANT) | $(QUANTIZED_DIR) - $(PNGQUANT) $(PNGQUANTFLAGS) -o "$@" "$<" + @($(PNGQUANT) $(PNGQUANTFLAGS) -o "$@" "$<"; case "$$?" in "98") cp $< $@;; *) exit "$$?";; esac) $(COMPRESSED_DIR)/%.png: $(QUANTIZED_DIR)/%.png | check_compress_tool $(COMPRESSED_DIR) ifdef MISSING_ZOPFLI