import Utils


class Transformer():
    def __init__(self, width, height):
        self.width = width
        self.height = height
        self.img_shape = (width, height)

    def Load_file(self, filepath):
        matrix = Utils.getMatrixfrom_bin(filepath)
        return matrix

    def transform(self, matrix):
        img = Utils.getIMGfrom_matrix(matrix)
        img = img.resize((self.width, self.height))
        return img


if __name__ == "__main__":
    config = Utils.readjson("config.json")
    Transformer = Transformer(
        config["advanced"]["img_width"], config["advanced"]["img_height"])
    matrix = Transformer.Load_file("data/train/hh.exe")
    img = Transformer.transform(matrix)
    img.show()
