from io import BytesIO
import aiohttp
import concurrent.futures
import functools
from PIL import Image

class ImageConvert:
    """
    Convert images automatically.
    """
    def __init__(self, bot):
        self.bot = bot
        print('Addon "{}" loaded'.format(self.__class__.__name__))

    async def on_message(self, message):
        # BMP conversion
        def img_convert(self, in_img):
            img_obj = Image.open(BytesIO(in_img))
            img_out = BytesIO()
            img_obj.save(img_out, 'png')
            img_out.seek(0)
            return img_out

        for f in message.attachments:
            if f["filename"].lower().endswith('.bmp') and f["size"] <= 600000:  # 600kb
                async with aiohttp.ClientSession() as session:
                    async with session.get(f["url"], timeout=45) as img_request:
                        img_content = await img_request.read()
                        with concurrent.futures.ProcessPoolExecutor() as pool:
                            img_out = await self.bot.loop.run_in_executor(pool, functools.partial(img_convert, img_content))
                        out_message = "{} from {}".format(self.bot.escape_name(f["filename"]), message.author.mention)
                        new_filename = f["filename"][:-3] + "png"
                        await self.bot.send_file(message.channel, img_out, filename=new_filename, content=out_message)

def setup(bot):
    bot.add_cog(ImageConvert(bot))

@@ -295,74 +295,22 @@
     
-async def on_message(self, message):%0A        # BMP conversion%0A    
+@staticmethod%0A
     
@@ -325,22 +325,16 @@
 convert(
-self, 
 in_img):
@@ -334,20 +334,16 @@
 n_img):%0A
-    
         
@@ -380,36 +380,32 @@
 n_img))%0A        
-  
-  
 img_out = BytesI
@@ -408,20 +408,16 @@
 tesIO()%0A
-    
         
@@ -445,20 +445,16 @@
  'png')%0A
-    
         
@@ -477,20 +477,16 @@
         
-    
 return i
@@ -493,16 +493,82 @@
 mg_out%0A%0A
+    async def on_message(self, message):%0A        # BMP conversion%0A
         
@@ -1069,16 +1069,21 @@
 partial(
+self.
 img_conv

fix implementation issues in #374