Skip to content

Commit

Permalink
fix: min 1 cell for width/height when inferring
Browse files Browse the repository at this point in the history
  • Loading branch information
3rd committed Nov 1, 2023
1 parent c91d47c commit 8ff8abc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/image/utils/math.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ local adjust_to_aspect_ratio = function(term_size, image_width, image_height, wi
local percent_orig_height = pixel_height / image_height

if width == 0 and height ~= 0 then
width = math.floor(pixel_height / term_size.cell_width * aspect_ratio)
width = math.max(1, math.floor(pixel_height / term_size.cell_width * aspect_ratio))
return width, height
end

if height == 0 and width ~= 0 then
height = math.floor(pixel_width / term_size.cell_height / aspect_ratio)
height = math.max(1, math.floor(pixel_width / term_size.cell_height / aspect_ratio))
return width, height
end

Expand Down

0 comments on commit 8ff8abc

Please sign in to comment.