From 0400b5f304d7d37135e808fd1b8d6c93629c5261 Mon Sep 17 00:00:00 2001 From: pirate486743186 Date: Mon, 31 Dec 2018 07:41:41 +0100 Subject: [PATCH] adding some missing mime types and extensions for reference https://en.wikipedia.org/wiki/BMP_file_format https://en.wikipedia.org/wiki/ICO_(file_format) https://en.wikipedia.org/wiki/Pcx https://en.wikipedia.org/wiki/Netpbm_format https://en.wikipedia.org/wiki/.tga --- src/PIL/BmpImagePlugin.py | 2 +- src/PIL/IcoImagePlugin.py | 2 ++ src/PIL/PcxImagePlugin.py | 2 ++ src/PIL/PpmImagePlugin.py | 2 +- src/PIL/TgaImagePlugin.py | 4 +++- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/PIL/BmpImagePlugin.py b/src/PIL/BmpImagePlugin.py index e146f4da9..43801b1f6 100644 --- a/src/PIL/BmpImagePlugin.py +++ b/src/PIL/BmpImagePlugin.py @@ -347,6 +347,6 @@ def _save(im, fp, filename): Image.register_open(BmpImageFile.format, BmpImageFile, _accept) Image.register_save(BmpImageFile.format, _save) -Image.register_extension(BmpImageFile.format, ".bmp") +Image.register_extensions(BmpImageFile.format, [".bmp", ".dib"]) Image.register_mime(BmpImageFile.format, "image/bmp") diff --git a/src/PIL/IcoImagePlugin.py b/src/PIL/IcoImagePlugin.py index 589ef3cc2..24c4bddca 100644 --- a/src/PIL/IcoImagePlugin.py +++ b/src/PIL/IcoImagePlugin.py @@ -293,3 +293,5 @@ class IcoImageFile(ImageFile.ImageFile): Image.register_open(IcoImageFile.format, IcoImageFile, _accept) Image.register_save(IcoImageFile.format, _save) Image.register_extension(IcoImageFile.format, ".ico") + +Image.register_mime(IcoImageFile.format, "image/x-icon") diff --git a/src/PIL/PcxImagePlugin.py b/src/PIL/PcxImagePlugin.py index daa58b3f3..bf55a88a3 100644 --- a/src/PIL/PcxImagePlugin.py +++ b/src/PIL/PcxImagePlugin.py @@ -177,3 +177,5 @@ Image.register_open(PcxImageFile.format, PcxImageFile, _accept) Image.register_save(PcxImageFile.format, _save) Image.register_extension(PcxImageFile.format, ".pcx") + +Image.register_mime(PcxImageFile.format, "image/x-pcx") diff --git a/src/PIL/PpmImagePlugin.py b/src/PIL/PpmImagePlugin.py index 8002678fb..c4183d311 100644 --- a/src/PIL/PpmImagePlugin.py +++ b/src/PIL/PpmImagePlugin.py @@ -155,4 +155,4 @@ def _save(im, fp, filename): Image.register_open(PpmImageFile.format, PpmImageFile, _accept) Image.register_save(PpmImageFile.format, _save) -Image.register_extensions(PpmImageFile.format, [".pbm", ".pgm", ".ppm"]) +Image.register_extensions(PpmImageFile.format, [".pbm", ".pgm", ".ppm", ".pnm"]) diff --git a/src/PIL/TgaImagePlugin.py b/src/PIL/TgaImagePlugin.py index c266d50c1..4c9bbc886 100644 --- a/src/PIL/TgaImagePlugin.py +++ b/src/PIL/TgaImagePlugin.py @@ -224,4 +224,6 @@ def _save(im, fp, filename): Image.register_open(TgaImageFile.format, TgaImageFile) Image.register_save(TgaImageFile.format, _save) -Image.register_extension(TgaImageFile.format, ".tga") +Image.register_extensions(TgaImageFile.format, [".tga", ".icb", ".vda", ".vst"]) + +Image.register_mime(TgaImageFile.format, "image/x-tga")