def generate_thumbnail_from_jpeg(self, document):
        thumbnail_temporary, thumbnail_directory = self.get_thumbnail_path(document)
        # Creating directory for thumbnail if not exists
        if not os.path.exists(thumbnail_directory):
            os.makedirs(thumbnail_directory)
        tmp_jpg = open(thumbnail_temporary + '.jpg', 'w')
        tmp_jpg.write(document.get_file_obj().read())
        tmp_jpg.close()
        os.system('convert %s.jpg -resize 65x65 %s.png' % (thumbnail_temporary, thumbnail_temporary))
        os.unlink(thumbnail_temporary + '.jpg')
Here you see and example of readying out a part of a DB
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/apps/dms_plugins/workers/transfer/thumbnails.py/ThumbnailsFilesystemHandler.generate_thumbnail_from_jpeg--crossover with--dataset/ETHPy150Open gijzelaerr/python-snap7/example/example.py/get_db_row