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

# Flux Pro - Expand image

> This endpoint allows you to expand an image using the AI Flux Pro model. The image will be expanded based on the provided parameters.

### Output size

`left`, `right`, `top` and `bottom` describe the expansion you are asking for,
but **this model does not guarantee that exact output size**. The requested
canvas is `input_width + left + right` by `input_height + top + bottom`, and
two rules are then applied to it:

1. **Maximum output size of roughly 1.6 megapixels.** If the requested canvas
   is larger, the whole image is scaled down proportionally until it fits. The
   aspect ratio is preserved, so there is no single maximum width or height:
   the cap applies to the total pixel count. A 1200x400 image expanded by 400
   pixels on each edge asks for a 2000x1200 canvas and comes back as 1632x976.
2. **Each side is rounded to the nearest multiple of 16.** A requested
   916x692 comes back as 912x688; a requested 936x712 comes back as 944x720.

Both rules apply on every request, including small ones, so an output that
matches your requested pixels exactly is the exception rather than the rule.

Omitting an edge applies its default (512 left, 512 right, 256 top, 256
bottom). Sending `0` leaves that edge unexpanded; sending `0` on all four
edges returns a `400`, since there is nothing to expand.

That said, **this is the expand endpoint that stays closest to the pixel
values you request**: below the 1.6 megapixel cap, the rounding to 16 is the
only deviation. Expanding an 896x672 image by 500 pixels on the top edge
alone asks for 896x1172 and returns 896x1168. The other two expand endpoints
diverge much further:
`ideogram` always renders at about 1 megapixel and only preserves the aspect
ratio, and `seedream-v4-5` scales any canvas below 3.7 megapixels up. If you
need exact output dimensions, resize the result yourself after generation.




## OpenAPI

````yaml post /v1/ai/image-expand/flux-pro
openapi: 3.0.0
info:
  description: >-
    The Magnific API is your gateway to a vast collection of high-quality
    digital resources for your applications and projects. As a leading platform,
    it offers a wide range of graphics, including vectors, photos,
    illustrations, icons, PSD templates, and more, all curated by talented
    designers from around the world.
  title: Magnific API
  version: 1.0.0
servers:
  - description: B2B API Production V1
    url: https://api.magnific.com
security:
  - magnificApiKey: []
paths:
  /v1/ai/image-expand/flux-pro:
    post:
      tags:
        - image-expand
      summary: Flux Pro - Expand image
      description: >
        This endpoint allows you to expand an image using the AI Flux Pro model.
        The image will be expanded based on the provided parameters.


        ### Output size


        `left`, `right`, `top` and `bottom` describe the expansion you are
        asking for,

        but **this model does not guarantee that exact output size**. The
        requested

        canvas is `input_width + left + right` by `input_height + top + bottom`,
        and

        two rules are then applied to it:


        1. **Maximum output size of roughly 1.6 megapixels.** If the requested
        canvas
           is larger, the whole image is scaled down proportionally until it fits. The
           aspect ratio is preserved, so there is no single maximum width or height:
           the cap applies to the total pixel count. A 1200x400 image expanded by 400
           pixels on each edge asks for a 2000x1200 canvas and comes back as 1632x976.
        2. **Each side is rounded to the nearest multiple of 16.** A requested
           916x692 comes back as 912x688; a requested 936x712 comes back as 944x720.

        Both rules apply on every request, including small ones, so an output
        that

        matches your requested pixels exactly is the exception rather than the
        rule.


        Omitting an edge applies its default (512 left, 512 right, 256 top, 256

        bottom). Sending `0` leaves that edge unexpanded; sending `0` on all
        four

        edges returns a `400`, since there is nothing to expand.


        That said, **this is the expand endpoint that stays closest to the pixel

        values you request**: below the 1.6 megapixel cap, the rounding to 16 is
        the

        only deviation. Expanding an 896x672 image by 500 pixels on the top edge

        alone asks for 896x1172 and returns 896x1168. The other two expand
        endpoints

        diverge much further:

        `ideogram` always renders at about 1 megapixel and only preserves the
        aspect

        ratio, and `seedream-v4-5` scales any canvas below 3.7 megapixels up. If
        you

        need exact output dimensions, resize the result yourself after
        generation.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/image-expand-request'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/task-detail-200-default-response'
        '400':
          $ref: '#/components/responses/400-bad-request'
        '401':
          $ref: '#/components/responses/401-unauthorized'
        '500':
          $ref: '#/components/responses/500-internal-server-error'
        '503':
          $ref: '#/components/responses/503-service-unavailable'
components:
  schemas:
    image-expand-request:
      properties:
        webhook_url:
          description: >
            Optional callback URL that will receive asynchronous notifications
            whenever the task changes status. The payload sent to this URL is
            the same as the corresponding GET endpoint response, but without the
            data field.
          example: https://www.example.com/webhook
          format: uri
          type: string
        image:
          description: Base64 image to expand
          format: byte
          type: string
        prompt:
          description: >-
            The description of the changes you want to make. This text guides
            the expansion process, allowing you to specify features, styles, or
            modifications for the expanded areas.
          type: string
        left:
          default: 512
          description: >
            Pixels to expand on the left. Omit the field to use the default of
            `512`;

            send `0` to leave this edge unexpanded. The requested size is not
            always

            the size you get back — see the description of this endpoint.
          maximum: 2048
          minimum: 0
          nullable: true
          type: integer
        right:
          default: 512
          description: >
            Pixels to expand on the right. Omit the field to use the default of
            `512`;

            send `0` to leave this edge unexpanded.
          maximum: 2048
          minimum: 0
          nullable: true
          type: integer
        top:
          default: 256
          description: >
            Pixels to expand on the top. Omit the field to use the default of
            `256`;

            send `0` to leave this edge unexpanded.
          maximum: 2048
          minimum: 0
          nullable: true
          type: integer
        bottom:
          default: 256
          description: >
            Pixels to expand on the bottom. Omit the field to use the default of
            `256`;

            send `0` to leave this edge unexpanded.
          maximum: 2048
          minimum: 0
          nullable: true
          type: integer
      required:
        - image
      type: object
    inline_object_4:
      example:
        data:
          generated:
            - https://openapi-generator.tech
            - https://openapi-generator.tech
          task_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
          status: CREATED
      properties:
        data:
          $ref: '#/components/schemas/task-detail_1'
      required:
        - data
      type: object
    inline_object:
      example:
        message: message
      properties:
        message:
          type: string
      type: object
    inline_object_1:
      properties:
        problem:
          $ref: '#/components/schemas/inline_object_1_problem'
      type: object
    inline_object_2:
      example:
        message: Internal Server Error
      properties:
        message:
          example: Internal Server Error
          type: string
      type: object
    inline_object_3:
      example:
        message: Service Unavailable. Please try again later.
      properties:
        message:
          example: Service Unavailable. Please try again later.
          type: string
      type: object
    task-detail_1:
      allOf:
        - $ref: '#/components/schemas/task'
        - properties:
            generated:
              items:
                description: URL of the generated image
                format: uri
                type: string
              type: array
          required:
            - generated
          type: object
      example:
        generated:
          - https://openapi-generator.tech
          - https://openapi-generator.tech
        task_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        status: CREATED
    inline_object_1_problem:
      properties:
        message:
          example: Validation error
          type: string
        invalid_params:
          items:
            $ref: '#/components/schemas/inline_object_1_problem_invalid_params_inner'
          type: array
      required:
        - invalid_params
        - message
      type: object
    task:
      example:
        task_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        status: CREATED
      properties:
        task_id:
          description: Task identifier
          format: uuid
          type: string
        status:
          description: Task status
          enum:
            - CREATED
            - IN_PROGRESS
            - COMPLETED
            - FAILED
          type: string
      required:
        - status
        - task_id
      type: object
    inline_object_1_problem_invalid_params_inner:
      properties:
        name:
          description: Name of the invalid parameter.
          example: page
          type: string
        field:
          description: Field of the invalid parameter. Mirrors `name`.
          example: page
          type: string
        reason:
          example: Parameter 'page' must be greater than 0
          type: string
      required:
        - field
        - name
        - reason
      type: object
  responses:
    task-detail-200-default-response:
      content:
        application/json:
          examples:
            success - created task:
              $ref: '#/components/examples/200-task-created'
            success - in progress task:
              $ref: '#/components/examples/200-task-in-progress'
            success - completed task:
              $ref: '#/components/examples/200-task-completed'
            success - failed task:
              $ref: '#/components/examples/200-task-failed'
          schema:
            $ref: '#/components/schemas/inline_object_4'
      description: OK - The task exists and the status is returned
    400-bad-request:
      content:
        application/json:
          examples:
            invalid_page:
              summary: Parameter 'page' is not valid
              value:
                message: Parameter 'page' must be greater than 0
            invalid_query:
              summary: Parameter 'query' is not valid
              value:
                message: Parameter 'query' must not be empty
            invalid_filter:
              summary: Parameter 'filter' is not valid
              value:
                message: Parameter 'filter' is not valid
            generic_bad_request:
              summary: Bad Request
              value:
                message: Parameter ':attribute' is not valid
          schema:
            $ref: '#/components/schemas/inline_object'
        application/problem+json:
          examples:
            invalid_page:
              summary: Parameter 'page' is not valid
              value:
                message: Validation error
                invalid_params:
                  - field: page
                    reason: Parameter 'page' must be greater than 0
                  - field: per_page
                    reason: Parameter 'per_page' must be greater than 0
          schema:
            $ref: '#/components/schemas/inline_object_1'
      description: >-
        Bad Request - The server could not understand the request due to invalid
        syntax.
    401-unauthorized:
      content:
        application/json:
          examples:
            invalid_api_key:
              summary: API key is not valid
              value:
                message: Invalid API key
            missing_api_key:
              summary: API key is not provided
              value:
                message: Missing API key
          schema:
            $ref: '#/components/schemas/inline_object'
      description: >-
        Unauthorized - The client must authenticate itself to get the requested
        response.
    500-internal-server-error:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/inline_object_2'
      description: >-
        Internal Server Error - The server has encountered a situation it
        doesn't know how to handle.
    503-service-unavailable:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/inline_object_3'
      description: Service Unavailable
  examples:
    200-task-created:
      summary: Success - Task created
      value:
        data:
          generated: []
          task_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
          status: CREATED
    200-task-in-progress:
      summary: Success - Task in progress
      value:
        data:
          generated: []
          task_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
          status: IN_PROGRESS
    200-task-completed:
      summary: Success - Task completed
      value:
        data:
          generated:
            - https://ai-statics.freepik.com/completed_task_image.jpg
          task_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
          status: COMPLETED
    200-task-failed:
      summary: Success - Task failed
      value:
        data:
          generated: []
          task_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
          status: FAILED
  securitySchemes:
    magnificApiKey:
      description: >
        Your Magnific API key. Required for authentication. [Learn how to obtain
        an API key](https://docs.magnific.com/quickstart)
      in: header
      name: x-magnific-api-key
      type: apiKey

````