Python PIL.Image 模块,ROTATE_180 实例源码

我们从Python开源项目中,提取了以下26个代码示例,用于说明如何使用PIL.Image.ROTATE_180

项目:imagepaste    作者:robinchenyu    | 项目源码 | 文件源码
def font_variant(self, font=None, size=None, index=None, encoding=None):
        """
        Create a copy of this FreeTypeFont object,
        using any specified arguments to override the settings.

        Parameters are identical to the parameters used to initialize this
        object.

        :return: A FreeTypeFont object.
        """
        return FreeTypeFont(font=self.path if font is None else font,
                            size=self.size if size is None else size,
                            index=self.index if index is None else index,
                            encoding=self.encoding if encoding is None else
                            encoding)

##
# Wrapper that creates a transposed font from any existing font
# object.
#
# @param font A font object.
# @param orientation An optional orientation.  If given, this should
#     be one of Image.FLIP_LEFT_RIGHT, Image.FLIP_TOP_BOTTOM,
#     Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.
项目:radar    作者:amoose136    | 项目源码 | 文件源码
def font_variant(self, font=None, size=None, index=None, encoding=None):
        """
        Create a copy of this FreeTypeFont object,
        using any specified arguments to override the settings.

        Parameters are identical to the parameters used to initialize this
        object.

        :return: A FreeTypeFont object.
        """
        return FreeTypeFont(font=self.path if font is None else font,
                            size=self.size if size is None else size,
                            index=self.index if index is None else index,
                            encoding=self.encoding if encoding is None else
                            encoding)

##
# Wrapper that creates a transposed font from any existing font
# object.
#
# @param font A font object.
# @param orientation An optional orientation.  If given, this should
#     be one of Image.FLIP_LEFT_RIGHT, Image.FLIP_TOP_BOTTOM,
#     Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.
项目:piSociEty    作者:paranoidninja    | 项目源码 | 文件源码
def response(self, response, request, data):
        try:
            isImage = getattr(request, 'isImage')
        except AttributeError:
            isImage = False

        if isImage:
            try:
                #For some reason more images get parsed using the parser
                #rather than a file...PIL still needs some work I guess
                p = ImageFile.Parser()
                p.feed(data)
                im = p.close()
                im = im.transpose(Image.ROTATE_180)
                output = StringIO()
                im.save(output, format=self.imageType)
                data = output.getvalue()
                output.close()
                self.clientlog.info("Flipped image", extra=request.clientInfo)
            except Exception as e:
                self.clientlog.info("Error: {}".format(e), extra=request.clientInfo)

        return {'response': response, 'request': request, 'data': data}
项目:WXBotForPi    作者:nemoTyrant    | 项目源码 | 文件源码
def font_variant(self, font=None, size=None, index=None, encoding=None):
        """
        Create a copy of this FreeTypeFont object,
        using any specified arguments to override the settings.

        Parameters are identical to the parameters used to initialize this
        object.

        :return: A FreeTypeFont object.
        """
        return FreeTypeFont(font=self.path if font is None else font,
                            size=self.size if size is None else size,
                            index=self.index if index is None else index,
                            encoding=self.encoding if encoding is None else
                            encoding)

##
# Wrapper that creates a transposed font from any existing font
# object.
#
# @param font A font object.
# @param orientation An optional orientation.  If given, this should
#     be one of Image.FLIP_LEFT_RIGHT, Image.FLIP_TOP_BOTTOM,
#     Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.
项目:mitmf    作者:ParrotSec    | 项目源码 | 文件源码
def response(self, response, request, data):
        try:
            isImage = getattr(request, 'isImage')
        except AttributeError:
            isImage = False

        if isImage:
            try:
                #For some reason more images get parsed using the parser
                #rather than a file...PIL still needs some work I guess
                p = ImageFile.Parser()
                p.feed(data)
                im = p.close()
                im = im.transpose(Image.ROTATE_180)
                output = StringIO()
                im.save(output, format=self.imageType)
                data = output.getvalue()
                output.close()
                self.clientlog.info("Flipped image", extra=request.clientInfo)
            except Exception as e:
                self.clientlog.info("Error: {}".format(e), extra=request.clientInfo)

        return {'response': response, 'request': request, 'data': data}
项目:django-binder    作者:CodeYellowBV    | 项目源码 | 文件源码
def image_transpose_exif(im):
    exif_orientation_tag = 0x0112  # contains an integer, 1 through 8
    exif_transpose_sequences = [   # corresponding to the following
        [],
        [Image.FLIP_LEFT_RIGHT],
        [Image.ROTATE_180],
        [Image.FLIP_TOP_BOTTOM],
        [Image.FLIP_LEFT_RIGHT, Image.ROTATE_90],
        [Image.ROTATE_270],
        [Image.FLIP_TOP_BOTTOM, Image.ROTATE_90],
        [Image.ROTATE_90],
    ]

    try:
        if im._getexif() is not None:
            seq = exif_transpose_sequences[im._getexif()[exif_orientation_tag] - 1]
            return functools.reduce(lambda im, op: im.transpose(op), seq, im)
        else:
            return im
    except KeyError:
        return im
项目:django-binder    作者:CodeYellowBV    | 项目源码 | 文件源码
def image_transpose_exif(im):
    exif_orientation_tag = 0x0112  # contains an integer, 1 through 8
    exif_transpose_sequences = [   # corresponding to the following
        [],
        [Image.FLIP_LEFT_RIGHT],
        [Image.ROTATE_180],
        [Image.FLIP_TOP_BOTTOM],
        [Image.FLIP_LEFT_RIGHT, Image.ROTATE_90],
        [Image.ROTATE_270],
        [Image.FLIP_TOP_BOTTOM, Image.ROTATE_90],
        [Image.ROTATE_90],
    ]

    try:
        if im._getexif() is not None:
            seq = exif_transpose_sequences[im._getexif()[exif_orientation_tag] - 1]
            return functools.reduce(lambda im, op: im.transpose(op), seq, im)
        else:
            return im
    except KeyError:
        return im
项目:SEF    作者:ahmadnourallah    | 项目源码 | 文件源码
def response(self, response, request, data):
        try:
            isImage = getattr(request, 'isImage')
        except AttributeError:
            isImage = False

        if isImage:
            try:
                #For some reason more images get parsed using the parser
                #rather than a file...PIL still needs some work I guess
                p = ImageFile.Parser()
                p.feed(data)
                im = p.close()
                im = im.transpose(Image.ROTATE_180)
                output = StringIO()
                im.save(output, format=self.imageType)
                data = output.getvalue()
                output.close()
                self.clientlog.info("Flipped image", extra=request.clientInfo)
            except Exception as e:
                self.clientlog.info("Error: {}".format(e), extra=request.clientInfo)

        return {'response': response, 'request': request, 'data': data}
项目:SEF    作者:ahmadnourallah    | 项目源码 | 文件源码
def handleResponse(self, request, data):
        try:
            isImage = getattr(request, 'isImage')
        except AttributeError:
            isImage = False

        if isImage:
            try:
                image_type = request.imageType
                #For some reason more images get parsed using the parser
                #rather than a file...PIL still needs some work I guess
                p = ImageFile.Parser()
                p.feed(data)
                im = p.close()
                im = im.transpose(Image.ROTATE_180)
                output = StringIO()
                im.save(output, format=image_type)
                data = output.getvalue()
                output.close()
                logging.info("Flipped image")
            except Exception as e:
                print "Error: %s" % e
        return {'request': request, 'data': data}
项目:teleport    作者:eomsoft    | 项目源码 | 文件源码
def font_variant(self, font=None, size=None, index=None, encoding=None):
        """
        Create a copy of this FreeTypeFont object,
        using any specified arguments to override the settings.

        Parameters are identical to the parameters used to initialize this
        object.

        :return: A FreeTypeFont object.
        """
        return FreeTypeFont(font=self.path if font is None else font,
                            size=self.size if size is None else size,
                            index=self.index if index is None else index,
                            encoding=self.encoding if encoding is None else
                            encoding)

##
# Wrapper that creates a transposed font from any existing font
# object.
#
# @param font A font object.
# @param orientation An optional orientation.  If given, this should
#     be one of Image.FLIP_LEFT_RIGHT, Image.FLIP_TOP_BOTTOM,
#     Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.
项目:teleport    作者:eomsoft    | 项目源码 | 文件源码
def font_variant(self, font=None, size=None, index=None, encoding=None):
        """
        Create a copy of this FreeTypeFont object,
        using any specified arguments to override the settings.

        Parameters are identical to the parameters used to initialize this
        object.

        :return: A FreeTypeFont object.
        """
        return FreeTypeFont(font=self.path if font is None else font,
                            size=self.size if size is None else size,
                            index=self.index if index is None else index,
                            encoding=self.encoding if encoding is None else
                            encoding)

##
# Wrapper that creates a transposed font from any existing font
# object.
#
# @param font A font object.
# @param orientation An optional orientation.  If given, this should
#     be one of Image.FLIP_LEFT_RIGHT, Image.FLIP_TOP_BOTTOM,
#     Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.
项目:SEF    作者:hossamhasanin    | 项目源码 | 文件源码
def response(self, response, request, data):
        try:
            isImage = getattr(request, 'isImage')
        except AttributeError:
            isImage = False

        if isImage:
            try:
                #For some reason more images get parsed using the parser
                #rather than a file...PIL still needs some work I guess
                p = ImageFile.Parser()
                p.feed(data)
                im = p.close()
                im = im.transpose(Image.ROTATE_180)
                output = StringIO()
                im.save(output, format=self.imageType)
                data = output.getvalue()
                output.close()
                self.clientlog.info("Flipped image", extra=request.clientInfo)
            except Exception as e:
                self.clientlog.info("Error: {}".format(e), extra=request.clientInfo)

        return {'response': response, 'request': request, 'data': data}
项目:SEF    作者:hossamhasanin    | 项目源码 | 文件源码
def handleResponse(self, request, data):
        try:
            isImage = getattr(request, 'isImage')
        except AttributeError:
            isImage = False

        if isImage:
            try:
                image_type = request.imageType
                #For some reason more images get parsed using the parser
                #rather than a file...PIL still needs some work I guess
                p = ImageFile.Parser()
                p.feed(data)
                im = p.close()
                im = im.transpose(Image.ROTATE_180)
                output = StringIO()
                im.save(output, format=image_type)
                data = output.getvalue()
                output.close()
                logging.info("Flipped image")
            except Exception as e:
                print "Error: %s" % e
        return {'request': request, 'data': data}
项目:ISeeNN    作者:sunshaoyan    | 项目源码 | 文件源码
def handle_exif(image_file):
    with Image.open(image_file) as image:
        orientation_key = 274
        exif = image._getexif()
        format = image.format
        if exif and orientation_key in exif:
            orientation = exif[orientation_key]
            rotate_values = {
                3: Image.ROTATE_180,
                6: Image.ROTATE_270,
                8: Image.ROTATE_90
            }
            if orientation in rotate_values:
                image = image.transpose(rotate_values[orientation])
        image_io = BytesIO()
        image.save(image_io, format)
        return image_io
项目:MITMf    作者:wi-fi-analyzer    | 项目源码 | 文件源码
def response(self, response, request, data):
        try:
            isImage = getattr(request, 'isImage')
        except AttributeError:
            isImage = False

        if isImage:
            try:
                #For some reason more images get parsed using the parser
                #rather than a file...PIL still needs some work I guess
                p = ImageFile.Parser()
                p.feed(data)
                im = p.close()
                im = im.transpose(Image.ROTATE_180)
                output = StringIO()
                im.save(output, format=self.imageType)
                data = output.getvalue()
                output.close()
                self.clientlog.info("Flipped image", extra=request.clientInfo)
            except Exception as e:
                self.clientlog.info("Error: {}".format(e), extra=request.clientInfo)

        return {'response': response, 'request': request, 'data': data}
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def __init__(self, font, orientation=None):
        """
        Wrapper that creates a transposed font from any existing font
        object.

        :param font: A font object.
        :param orientation: An optional orientation.  If given, this should
            be one of Image.FLIP_LEFT_RIGHT, Image.FLIP_TOP_BOTTOM,
            Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.
        """
        self.font = font
        self.orientation = orientation  # any 'transpose' argument, or None
项目:pudzu    作者:Udzu    | 项目源码 | 文件源码
def mask(cls, size, round=0):
        """Rectangular mask with optional rounded corners."""
        m = Image.new("L", size, 255)
        if round > 0:
            w, h = int(round * size[0] / 2), int(round * size[1] / 2)
            m.place(Quadrant.mask((w,h)), align=(0,0), copy=False)
            m.place(Quadrant.mask((w,h)).transpose(Image.FLIP_LEFT_RIGHT), align=(1,0), copy=False)
            m.place(Quadrant.mask((w,h)).transpose(Image.FLIP_TOP_BOTTOM), align=(0,1), copy=False)
            m.place(Quadrant.mask((w,h)).transpose(Image.ROTATE_180), align=(1,1), copy=False)
        return m
项目:mean-teacher    作者:CuriousAI    | 项目源码 | 文件源码
def __call__(self, old_image):
        xtranslation, ytranslation = np.random.randint(-self.max_translation,
                                                       self.max_translation + 1,
                                                       size=2)
        xpad, ypad = abs(xtranslation), abs(ytranslation)
        xsize, ysize = old_image.size

        flipped_lr = old_image.transpose(Image.FLIP_LEFT_RIGHT)
        flipped_tb = old_image.transpose(Image.FLIP_TOP_BOTTOM)
        flipped_both = old_image.transpose(Image.ROTATE_180)

        new_image = Image.new("RGB", (xsize + 2 * xpad, ysize + 2 * ypad))

        new_image.paste(old_image, (xpad, ypad))

        new_image.paste(flipped_lr, (xpad + xsize - 1, ypad))
        new_image.paste(flipped_lr, (xpad - xsize + 1, ypad))

        new_image.paste(flipped_tb, (xpad, ypad + ysize - 1))
        new_image.paste(flipped_tb, (xpad, ypad - ysize + 1))

        new_image.paste(flipped_both, (xpad - xsize + 1, ypad - ysize + 1))
        new_image.paste(flipped_both, (xpad + xsize - 1, ypad - ysize + 1))
        new_image.paste(flipped_both, (xpad - xsize + 1, ypad + ysize - 1))
        new_image.paste(flipped_both, (xpad + xsize - 1, ypad + ysize - 1))

        new_image = new_image.crop((xpad - xtranslation,
                                    ypad - ytranslation,
                                    xpad + xsize - xtranslation,
                                    ypad + ysize - ytranslation))

        return new_image
项目:dirpy    作者:redfin    | 项目源码 | 文件源码
def transpose(self, opts): ###############################################

        self.logger.debug("Transposing image %s: %s" 
            % (self.file_path, str(opts)))


        # Parse possible arguments
        num_args = 0
        if "flipvert" in opts:
            method = Image.FLIP_LEFT_RIGHT
            num_args += 1
        if "fliphorz" in opts:
            method = Image.FLIP_TOP_BOTTOM
            num_args += 1
        if "rotate90" in opts:
            method = Image.ROTATE_90
            num_args += 1
        if "rotate180" in opts:
            method = Image.ROTATE_180
            num_args += 1
        if "rotate270" in opts:
            method = Image.ROTATE_270
            num_args += 1

        if num_args != 1:
            raise DirpyUserError(
                "Transpose requires exactly one option: %s" % str(opts))

        # Now rotate
        try:
            self.im_in = self.im_in.transpose(method)
            self.out_x, self.out_y = self.im_in.size
            self.modified = True
        except Exception as e:
            raise DirpyFatalError(
                "Error transposing image %s: %s" % (self.file_path,e))


    # Write an image to a BytesIO output buffer
项目:mountain_tapir    作者:tttppp    | 项目源码 | 文件源码
def __generateRotatedImage(self, image):
        """Use the current rotation of this `ImageFile` to rotate :class:`PIL.Image`.

        :param image: The input image.
        :return image: The output image."""
        if self.rotation == 1:
            image = image.transpose(Image.ROTATE_90)
        elif self.rotation == 2:
            image = image.transpose(Image.ROTATE_180)
        elif self.rotation == 3:
            image = image.transpose(Image.ROTATE_270)
        return image
项目:mosaicshapes    作者:skiptomyliu    | 项目源码 | 文件源码
def image_transpose_exif(im):
    exif_orientation_tag = 0x0112 # contains an integer, 1 through 8
    exif_transpose_sequences = [  # corresponding to the following
        [],
        [Image.FLIP_LEFT_RIGHT],
        [Image.ROTATE_180],
        [Image.FLIP_TOP_BOTTOM],
        [Image.FLIP_LEFT_RIGHT, Image.ROTATE_90],
        [Image.ROTATE_270],
        [Image.FLIP_TOP_BOTTOM, Image.ROTATE_90],
        [Image.ROTATE_90],
    ]

    try:
        seq = exif_transpose_sequences[im._getexif()[exif_orientation_tag] - 1]
    except Exception:
        return im
    else:
        return functools.reduce(lambda im, op: im.transpose(op), seq, im)

# def average_color_pixels(image, pixels):
#     r,g,b = 0,0,0
#     for pixel in pixels:
#         x,y = pixel
#         cr,cg,cb = image.getpixel((x,y))
#         r+=cr
#         g+=cg
#         b+=cb

#     total = len(pixels)
#     return (r/total, g/total, b/total)
项目:alfred-image-utilities    作者:danielecook    | 项目源码 | 文件源码
def __init__(self, font, orientation=None):
        """
        Wrapper that creates a transposed font from any existing font
        object.

        :param font: A font object.
        :param orientation: An optional orientation.  If given, this should
            be one of Image.FLIP_LEFT_RIGHT, Image.FLIP_TOP_BOTTOM,
            Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.
        """
        self.font = font
        self.orientation = orientation  # any 'transpose' argument, or None
项目:tn2    作者:hsoft    | 项目源码 | 文件源码
def exif_orientation(im):
    try:
        exif = im._getexif()
    except Exception:
        # There are many ways that _getexif fails, we're just going to blanket
        # cover them all.
        return im
    if exif is None:
        return im
    orientation = exif.get(0x0112)
    if orientation == 2:
        im = im.transpose(Image.FLIP_LEFT_RIGHT)
    elif orientation == 3:
        im = im.transpose(Image.ROTATE_180)
    elif orientation == 4:
        im = im.transpose(Image.FLIP_TOP_BOTTOM)
    elif orientation == 5:
        im = im.transpose(Image.ROTATE_270).transpose(Image.FLIP_LEFT_RIGHT)
    elif orientation == 6:
        im = im.transpose(Image.ROTATE_270)
    elif orientation == 7:
        im = im.transpose(Image.ROTATE_90).transpose(Image.FLIP_LEFT_RIGHT)
    elif orientation == 8:
        im = im.transpose(Image.ROTATE_90)
    return im

# Low-tech approach to work around the too strict URLValidator.
# Context: https://code.djangoproject.com/ticket/20264
# replace() isn't super elegant, but I prefer this to having to copy/paste the whole big regexp
# soup from URLValidator so that I can add one underscore...
项目:toshi-admin-service    作者:toshiapp    | 项目源码 | 文件源码
def process_image(data, mime_type):
    stream = io.BytesIO(data)
    try:
        img = Image.open(stream)
    except OSError:
        raise ValueError('Invalid image data')

    if mime_type == 'image/jpeg' and img.format == 'JPEG':
        format = "JPEG"
        subsampling = 'keep'
        # check exif information for orientation
        if hasattr(img, '_getexif'):
            x = img._getexif()
            if x and EXIF_ORIENTATION in x and x[EXIF_ORIENTATION] > 1 and x[EXIF_ORIENTATION] < 9:
                orientation = x[EXIF_ORIENTATION]
                subsampling = get_sampling(img)
                if orientation == 2:
                    # Vertical Mirror
                    img = img.transpose(Image.FLIP_LEFT_RIGHT)
                elif orientation == 3:
                    # Rotation 180°
                    img = img.transpose(Image.ROTATE_180)
                elif orientation == 4:
                    # Horizontal Im
                    img = img.transpose(Image.FLIP_TOP_BOTTOM)
                elif orientation == 5:
                    # Horizontal Im + Rotation 90° CCW
                    img = img.transpose(Image.FLIP_TOP_BOTTOM).transpose(Image.ROTATE_90)
                elif orientation == 6:
                    # Rotation 270°
                    img = img.transpose(Image.ROTATE_270)
                elif orientation == 7:
                    # Horizontal Im + Rotation 270°
                    img = img.transpose(Image.FLIP_TOP_BOTTOM).transpose(Image.ROTATE_270)
                elif orientation == 8:
                    # Rotation 90°
                    img = img.transpose(Image.ROTATE_90)
        save_kwargs = {'subsampling': subsampling, 'quality': 85}
    elif mime_type == 'image/png' and img.format == 'PNG':
        format = "PNG"
        save_kwargs = {'icc_profile': img.info.get("icc_profile")}
    else:
        raise ValueError('Unsupported image format')

    if img.size[0] > 512 or img.size[1] > 512:
        img.thumbnail((512, 512))

    stream = io.BytesIO()
    img.save(stream, format=format, optimize=True, **save_kwargs)

    data = stream.getbuffer().tobytes()
    hasher = hashlib.md5()
    hasher.update(data)
    cache_hash = hasher.hexdigest()

    return data, cache_hash, format
项目:toshi-id-service    作者:toshiapp    | 项目源码 | 文件源码
def process_image(data, mime_type):
    stream = io.BytesIO(data)
    try:
        img = Image.open(stream)
    except OSError:
        raise JSONHTTPError(400, body={'errors': [{'id': 'bad_arguments', 'message': 'Invalid image data'}]})

    if mime_type == 'image/jpeg' and img.format == 'JPEG':
        format = "JPEG"
        subsampling = 'keep'
        # check exif information for orientation
        if hasattr(img, '_getexif'):
            x = img._getexif()
            if x and EXIF_ORIENTATION in x and x[EXIF_ORIENTATION] > 1 and x[EXIF_ORIENTATION] < 9:
                orientation = x[EXIF_ORIENTATION]
                subsampling = get_sampling(img)
                if orientation == 2:
                    # Vertical Mirror
                    img = img.transpose(Image.FLIP_LEFT_RIGHT)
                elif orientation == 3:
                    # Rotation 180°
                    img = img.transpose(Image.ROTATE_180)
                elif orientation == 4:
                    # Horizontal Im
                    img = img.transpose(Image.FLIP_TOP_BOTTOM)
                elif orientation == 5:
                    # Horizontal Im + Rotation 90° CCW
                    img = img.transpose(Image.FLIP_TOP_BOTTOM).transpose(Image.ROTATE_90)
                elif orientation == 6:
                    # Rotation 270°
                    img = img.transpose(Image.ROTATE_270)
                elif orientation == 7:
                    # Horizontal Im + Rotation 270°
                    img = img.transpose(Image.FLIP_TOP_BOTTOM).transpose(Image.ROTATE_270)
                elif orientation == 8:
                    # Rotation 90°
                    img = img.transpose(Image.ROTATE_90)
        save_kwargs = {'subsampling': subsampling, 'quality': 85}
    elif mime_type == 'image/png' and img.format == 'PNG':
        format = "PNG"
        save_kwargs = {'icc_profile': img.info.get("icc_profile")}
    else:
        raise JSONHTTPError(400, body={'errors': [{'id': 'bad_arguments', 'message': 'Unsupported image format'}]})

    if img.size[0] > 512 or img.size[1] > 512:
        img.thumbnail((512, 512))

    stream = io.BytesIO()
    img.save(stream, format=format, optimize=True, **save_kwargs)

    data = stream.getbuffer().tobytes()
    hasher = hashlib.md5()
    hasher.update(data)
    cache_hash = hasher.hexdigest()

    return data, cache_hash, format
项目:cancer    作者:yancz1989    | 项目源码 | 文件源码
def rotate_image(input_file, input_box):
  prefix = os.path.splitext(input_file)[0]
  x1 = input_box[0]["x1"]
  y1 = input_box[0]["y1"]
  x2 = input_box[0]["x2"]
  y2 = input_box[0]["y2"]
  im = Image.open(input_file)
  im1 = im.transpose(Image.ROTATE_90)
  im2 = im.transpose(Image.ROTATE_180)
  im3 = im.transpose(Image.ROTATE_270)
  output_file = [
    prefix + "_rotate_1.bmp",
    prefix + "_rotate_2.bmp",
    prefix + "_rotate_3.bmp",
  ]
  output_box = [
    {
      "x1": y1,
      "x2": y2,
      "y1": SIZE - 1 - x1,
      "y2": SIZE - 1 - x2,
    },
    {
      "x1": SIZE - 1 - x1,
      "x2": SIZE - 1 - x2,
      "y1": SIZE - 1 - y1,
      "y2": SIZE - 1 - y2,
    },
    {
      "x1": SIZE - 1 - y1,
      "x2": SIZE - 1 - y2,
      "y1": x1,
      "y2": x2,
    },
  ]
  im1.save(output_file[0])
  im2.save(output_file[1])
  im3.save(output_file[2])
  # draw_box(im1, output_box[0]).save(output_file[0])
  # draw_box(im2, output_box[1]).save(output_file[1])
  # draw_box(im3, output_box[2]).save(output_file[2])

  return output_file, output_box