AI Photo Trainer PhotoRater

Image Rotation System

The image rotation system allows you to correct orientation issues without modifying original files, and re-run ML analysis with properly oriented images for accurate results.

New in Version 0.9.0: This feature was added in November 2025 to address orientation issues from cameras that don't respect EXIF data or save images in incorrect orientations.

Overview

The image rotation system solves several common problems:

  • Incorrect camera orientation - Some cameras save images rotated incorrectly
  • EXIF data ignored - The app doesn't read EXIF orientation tags, requiring manual correction
  • Failed ML analysis - Pose detection and face detection fail on sideways or upside-down images
  • Batch import issues - Hot folder imports couldn't handle rotated images automatically

Key Features:

  • Non-destructive - Original files are never modified
  • Default rotation for hot folders - Set a global rotation for all future imports
  • Per-image manual overrides - Rotate individual images as needed
  • ML re-analysis - Re-run pose detection, face detection, and quality scoring with correct orientation
  • Instant visual feedback - Images rotate immediately in the interface

Default Rotation Settings

Default rotation settings apply to all future hot folder imports, automatically rotating images before ML analysis runs.

Accessing Settings

  1. Navigate to Settings page (gear icon in sidebar)
  2. Scroll to the Default Rotation Settings section
  3. Select your desired rotation option
  4. Click Save Default Rotation

Rotation Options

Option Degrees Use Case
No Rotation Images are already correctly oriented (default)
Rotate 90° Clockwise 90° Landscape images shot in portrait mode (camera held vertically)
Rotate 180° 180° Upside-down images (camera held inverted)
Rotate 270° Clockwise 270° Portrait images shot in landscape mode (90° counter-clockwise)

Important: Default rotation only affects new images imported via hot folders. Existing images in your library are not affected. Use manual rotation for those.

Manual Image Rotation

You can rotate individual images at any time, regardless of the default rotation setting.

Rotating a Single Image

  1. Click on an image in the grid to open the Image Detail view
  2. Look for the rotation controls below the image
  3. Click Rotate 90° to rotate clockwise
  4. The image rotates visually (you'll see it turn immediately)
  5. Click again to continue rotating: 90° → 180° → 270° → 0° (cycles back)

Note: Visual rotation happens instantly using CSS, but ML analysis scores (quality rating, pose detection, etc.) won't update until you click "Re-analyze".

Re-analyzing with Rotation

After rotating an image, you'll want to re-run the ML analysis to get accurate scores:

  1. Rotate the image to the correct orientation (as described above)
  2. Click Re-analyze with Current Rotation
  3. Wait 2-5 seconds while the backend processes the image
  4. The app returns to the images list automatically
  5. Click the image again to view the updated analysis results

What gets re-analyzed:

  • Quality rating (overall score)
  • Pose detection (body position, posture)
  • Face detection (eyes, smile, clarity)
  • Eye detection (left/right eye visibility)
  • Technical quality (sharpness, exposure, composition)

Pro Tip: If pose detection previously failed (score of 0), re-analyzing with the correct rotation often fixes the issue and provides accurate pose scores.

Resetting Rotation

To return an image to its original orientation:

  1. Open the image in Image Detail view
  2. Click Reset to 0°
  3. The image returns to 0° rotation
  4. Optionally click Re-analyze to update ML scores

How Rotation Works

Non-Destructive Process:

  1. Visual rotation - Uses CSS transform: rotate(Xdeg) for instant display
  2. Database storage - Rotation angle stored in rotation_degrees column
  3. ML processing - When re-analyzing, OpenCV rotates the image in memory before ML models process it
  4. Original preservation - Physical image files on disk are never modified

Technical Implementation:

# Backend uses OpenCV for lossless rotation
def _rotate_image_cv2(self, img, degrees):
    if degrees == 90:
        return cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE)
    elif degrees == 180:
        return cv2.rotate(img, cv2.ROTATE_180)
    elif degrees == 270:
        return cv2.rotate(img, cv2.ROTATE_90_COUNTERCLOCKWISE)
    return img

Performance:

  • Visual rotation: Instant (CSS transform)
  • ML re-analysis: 2-5 seconds per image (same as initial analysis)
  • No quality loss: OpenCV rotation is lossless for 90° increments
  • Database overhead: Minimal (single integer column)

Best Practices

Scenario Recommendation
New photographer with consistent camera orientation issue Set default rotation in Settings before importing images. This saves time vs. rotating individually.
Mixed orientations in one session Import without default rotation, then manually rotate only the affected images.
Pose detection failing Check if the person is sideways or upside-down. Rotate and re-analyze to fix.
Already imported 1000+ images with wrong orientation Unfortunately, batch rotation isn't available yet. Future enhancement planned.
Unsure which rotation is correct Cycle through all four options (0°/90°/180°/270°) and re-analyze each to see which gives the best scores.

Troubleshooting

Common Issues and Solutions:

Issue Solution
Image rotates visually but scores don't change You must click Re-analyze with Current Rotation to update ML scores. Visual rotation is just CSS.
Re-analyze button does nothing
  1. Check if backend is running (status in bottom-left corner)
  2. Wait 2-5 seconds for processing
  3. Check for error messages in the app
Default rotation doesn't apply to new images
  1. Verify you clicked Save Default Rotation
  2. Check Settings page to confirm the setting persisted
  3. Only affects new hot folder imports, not existing images
All images appear rotated incorrectly Your default rotation setting may be wrong. Go to Settings → Default Rotation and choose "No Rotation (0°)".
Session ends after re-analyzing This was a bug in earlier versions. Update to version 0.9.0 or later. The app now properly navigates back to the images list.

Known Limitations:

  • No batch rotation tool (must rotate images one at a time)
  • Custom angles not supported (only 90° increments)
  • EXIF orientation tags are not automatically detected
  • Manual re-analysis required (not automatic on rotation)

Related Documentation: Rating WorkflowSettings & ThresholdsHot Folder MonitoringTroubleshooting