From cb2076f1206b5a26341947ae25000349310d1f3a Mon Sep 17 00:00:00 2001 From: stanleyqubit Date: Tue, 16 Sep 2025 22:03:39 +0300 Subject: [PATCH] [crop] Add option to show info about the crop zone aspect ratio --- script-opts/crop.conf | 1 + scripts/crop.lua | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/script-opts/crop.conf b/script-opts/crop.conf index 9f75cdf..a71e59e 100644 --- a/script-opts/crop.conf +++ b/script-opts/crop.conf @@ -8,6 +8,7 @@ mode=hard draw_crosshair=yes draw_text=yes +draw_text_dar=no draw_shade=yes draw_frame=yes frame_border_width=2 diff --git a/scripts/crop.lua b/scripts/crop.lua index adbfaa3..ee00cf4 100644 --- a/scripts/crop.lua +++ b/scripts/crop.lua @@ -7,6 +7,7 @@ local opts = { frame_border_color = "EEEEEE", draw_crosshair = true, draw_text = true, + draw_text_dar = false, mouse_support = true, coarse_movement = 30, left_coarse = "LEFT", @@ -247,10 +248,16 @@ function draw_crop_zone() local cursor_norm = screen_to_video_norm(cursor, dim) local text = string.format("%d, %d", cursor_norm.x * vop.w, cursor_norm.y * vop.h) if crop_first_corner then + local crop_zone_w = math.abs((cursor_norm.x - crop_first_corner.x) * vop.w ) + local crop_zone_h = math.abs((cursor_norm.y - crop_first_corner.y) * vop.h ) text = string.format("%s (%dx%d)", text, - math.abs((cursor_norm.x - crop_first_corner.x) * vop.w ), - math.abs((cursor_norm.y - crop_first_corner.y) * vop.h ) + crop_zone_w, + crop_zone_h ) + if opts.draw_text_dar then + local crop_zone_dar = crop_zone_w / crop_zone_h * (vop.par or 1) + text = string.format("%s DAR: %.3f", text, crop_zone_dar) + end end draw_position_text(ass, text, cursor, { w = dim.w, h = dim.h }, 6) end