diff --git a/croppa/main.py b/croppa/main.py index 5e0ae60..fde60fd 100644 --- a/croppa/main.py +++ b/croppa/main.py @@ -3071,39 +3071,19 @@ class VideoEditor: height, width = display_frame.shape[:2] available_height = self.window_height - (0 if self.is_image_mode else self.TIMELINE_HEIGHT) - # Don't downscale - keep original video quality - # If video is larger than window, we'll handle it by resizing the window + # Scale video to fit screen bounds scale = min(self.window_width / width, available_height / height) if scale < 1.0: - # Resize window to fit video instead of downscaling video - new_window_width = int(width * 1.1) # Add 10% padding - new_window_height = int(height * 1.1) + (0 if self.is_image_mode else self.TIMELINE_HEIGHT) - - # Update window size - self.window_width = new_window_width - self.window_height = new_window_height - - # Resize the OpenCV window - window_title = "Image Editor" if self.is_image_mode else "Video Editor" - cv2.resizeWindow(window_title, self.window_width, self.window_height) + # Scale down video to fit screen + new_width = int(width * scale) + new_height = int(height * scale) + display_frame = cv2.resize(display_frame, (new_width, new_height), interpolation=cv2.INTER_LINEAR) # Create canvas with timeline space canvas = np.zeros((self.window_height, self.window_width, 3), dtype=np.uint8) # Center the frame on canvas frame_height, frame_width = display_frame.shape[:2] - available_height = self.window_height - (0 if self.is_image_mode else self.TIMELINE_HEIGHT) - - # Simple fullscreen fix: scale down if video is too large for screen - if self.is_fullscreen and (frame_height > available_height or frame_width > self.window_width): - scale_x = self.window_width / frame_width - scale_y = available_height / frame_height - scale = min(scale_x, scale_y) - if scale < 1.0: - new_width = int(frame_width * scale) - new_height = int(frame_height * scale) - display_frame = cv2.resize(display_frame, (new_width, new_height), interpolation=cv2.INTER_LINEAR) - frame_height, frame_width = display_frame.shape[:2] start_y = (available_height - frame_height) // 2 start_x = (self.window_width - frame_width) // 2