> ## Documentation Index
> Fetch the complete documentation index at: https://docs.img-processing.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mirror Image

> Creates a new image by mirroring the original image horizontally or vertically.

### Description

With this endpoint, you can mirror an existing image horizontally or vertically to create a new image.

Mirror an image horizontally means that the image is mirrored along the vertical axis, while flipping an
image vertically means that the image is mirrored along the horizontal axis. You can also mirror an image
horizontally and vertically at the same time using the mode `both`.

<Frame caption="Mirroring an image horizontally">
  <img src="https://mintcdn.com/imgprocessing/96najFJQ0rXKRJFY/images/flip.png?fit=max&auto=format&n=96najFJQ0rXKRJFY&q=85&s=72fe4531337f2151f6f61ad309e3b236" alt="Mirror Image" width="350" height="178" data-path="images/flip.png" />
</Frame>

***


## OpenAPI

````yaml openapi.json post /v1/images/{image_id}/mirror
openapi: 3.1.0
info:
  title: IMG Processing API
  description: >
    This powerful and flexible API provides a wide range of

    image manipulation and analysis capabilities, allowing developers to
    integrate advanced image processing

    features into their applications with ease.
  version: 1.0.0
servers:
  - url: https://api.img-processing.com
    description: IMG Processing API Server
security:
  - ApiKeyAuth: []
paths:
  /v1/images/{image_id}/mirror:
    post:
      tags:
        - Transformation Endpoints
      summary: Mirror Image
      description: >-
        With this endpoint, you can mirror an existing image horizontally or
        vertically to create a new image.


        Mirror an image horizontally means that the image is mirrored along the
        vertical axis, while flipping an image vertically means that the image
        is mirrored along the horizontal axis. You can also mirror an image
        horizontally and vertically at the same time using the mode both
      operationId: mirror
      parameters:
        - in: path
          name: image_id
          schema:
            type: string
            description: >-
              The unique identifier of the image. This identifier is used to
              reference the image in subsequent requests.
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                mode:
                  type: string
                  enum:
                    - horizontal
                    - vertical
                    - both
                  description: >-
                    The mode of mirroring. It can be horizontal, vertical, or
                    both.
                name:
                  type: string
                  minLength: 1
                  maxLength: 30
                  description: The name of the image to identify it on the dashboard.
              required:
                - mode
              examples:
                - mode: horizontal
                  name: mirrored-image
      responses:
        '201':
          description: The API will return the Image object in the response body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageObject'
        '401':
          description: >-
            Error object for unauthorized access. Probably due to missing or
            invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: >-
            Error object for forbidden access. Probably due to insufficient
            permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '422':
          description: Error object for validation errors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '429':
          description: Error object for rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
        5XX:
          description: Error object for internal server errors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerError'
components:
  schemas:
    ImageObject:
      type: object
      properties:
        id:
          type: string
          description: >-
            The unique identifier of the image. This identifier is used to
            reference the image in subsequent requests.
        name:
          type: string
          description: >-
            The name of the image. This name is provided when uploading the
            image and is the way the image is identified in your account. It is
            not unique, in fact, each transformation you make to an image will
            create a new image with the same name.
        url:
          type:
            - string
            - 'null'
          description: >-
            The public URL of the image. By default, this URL is not available
            and will be `null`. You can make the image public by using the
            publish endpoint. Once the image is public, the URL will be updated
            with the public UR.
        width:
          type: number
          description: The width of the image in pixels.
        height:
          type: number
          description: The height of the image in pixels.
        format:
          type: string
          enum:
            - png
            - jpeg
            - webp
          description: >-
            The format of the image. The format can be one of the following:
            `jpeg`, `png`, `webp`
        size:
          type: number
          description: >-
            The estimated size of the image in bytes. The size is an estimate
            and may not be exact since images can be compressed or optimized
            depending on the format and quality settings used during processing.
        created_at:
          type: string
          format: date-time
          description: >-
            The date and time when the image was created. The date and time are
            in ISO 8601 format.
      required:
        - id
        - name
        - width
        - height
        - format
        - size
        - created_at
      title: Image Object
      description: >-
        The Image object represents an image processed using the IMG Processing
        API. The object contains information about the image, such as its URL,
        size, and format. The Image object is returned in the response body of
        all image processing requests.
      examples:
        - id: image_etm0g3x5iap4cld1qcfsjvo2
          name: Processed Image
          url: >-
            https://storage.img-processing.com/images/image_etm0g3x5iap4cld1qcfsjvo2
          width: 460
          height: 460
          format: jpeg
          size: 282000
          created_at: '2021-09-01T12:00:00.000Z'
    UnauthorizedError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          const: 401
          description: The status of the error
        message:
          type: string
          description: The error message
      required:
        - type
        - error
        - status
        - message
      title: Unauthorized Error
      description: >-
        Error object for unauthorized access. Probably due to missing or invalid
        API key
      examples:
        - type: https://docs.img-processing.com/errors/unauthorized
          error: Unauthorized
          status: 401
          message: API key is required.
    ForbiddenError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          const: 403
          description: The status of the error
        message:
          type: string
          description: The error message
      required:
        - type
        - error
        - status
        - message
      title: Forbidden Error
      description: >-
        Error object for forbidden access. Probably due to insufficient
        permissions.
      examples:
        - type: https://docs.img-processing.com/errors/forbidden
          error: Forbidden
          status: 403
          message: You are not allowed to access this image.
    ValidationError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          const: 422
          description: The status of the error
        errors:
          type: array
          items:
            type: string
          description: The validation errors
      required:
        - type
        - error
        - status
        - errors
      title: Validation Error
      description: Error object for validation errors
      examples:
        - type: https://docs.img-processing.com/errors/validation-error
          error: Validation Error
          status: 422
          errors:
            - '{field or param} {error message}'
    RateLimitError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          const: 429
          description: The status of the error
        message:
          type: string
          description: The error message
      required:
        - type
        - error
        - status
        - message
      title: Rate Limit Error
      description: Error object for rate limit exceeded.
      examples:
        - type: https://docs.img-processing.com/errors/too-many-requests
          error: Too Many Requests
          status: 429
          message: Rate limit exceeded. Try again later.
    ServerError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          description: The status of the error
        message:
          type: string
          description: The error message
      required:
        - type
        - error
        - status
        - message
      title: Server Error
      description: Error object for internal server errors.
      examples:
        - type: https://docs.img-processing.com/errors/internal-error
          error: Internal Error
          status: 500
          message: >-
            An unexpected error occurred. Please try again later. If the problem
            persists, contact support.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key for authentication

````