Image enhancement

Enhance a photo and straighten vertical lines

Auto-enhances the photo and corrects perspective so vertical lines are straight. Costs 1 credit. Responds in ~15s.

post/api/enhance_and_correct_perspective

Request

  • Base URL: https://app.pedra.ai
  • URL: https://app.pedra.ai/api/enhance_and_correct_perspective
  • Auth: none required

Request body

apiKeystring required

Account API key, sent in the request body. Get one at https://app.pedra.ai under Settings → API.

imageUrlstring required

A publicly accessible HTTPS image URL or a base64 data URI (data:image/png;base64,...). Remote URLs are fetched within ~20s; use base64 for auth-walled or short-lived presigned URLs.

highFidelityboolean

Non-generative enhancement plus perspective correction: adjusts only light, sharpness, and perspective, keeping colors, materials, and object sizes exactly as in the original. When true, preserveOriginalFraming is ignored.

preserveOriginalFramingboolean

Keep the original framing, aspect ratio, and resolution exactly (no edge crop). The enhancement is still AI-generated, so colors/materials may shift slightly — use highFidelity if they must stay identical. Ignored when highFidelity is true.

preserveAspectRatioboolean

By default, the output comes back at whatever size the AI model produces, which may not match the aspect ratio or resolution of your photo. Set to true to get the result at the exact width and height of the input image: it is center-cropped to the original aspect ratio (never stretched) and resized to the original resolution.

propertyIdstring

Optional id of the property (from /api/list_properties or /api/create_property) this photo/video belongs to. When set, the result is saved into that property's gallery (or, for create_video, its Videos tab) — visible and editable from the app — instead of only being returned as a URL.

namestring

Optional name for the original photo (e.g. its file name). Requires propertyId. If the photo isn't in that property yet, it is saved there under this name in the same call (no need to call add_images_to_property first) and returned as source.name. A photo already in the property keeps its current name. Never drawn on the image.

Example request

{
  "imageUrl": "https://example.com/photo.jpg"
}

Response

Success. output is an array with exactly one generated image.

messagestring

Example response

{
  "message": "Success",
  "output": [
    {
      "url": "https://img.pedra.ai/generated-id"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.