crop_image(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸ’… crop_image(3) β€” the Arcan Lua API bestie era ✨

okay so real talk, this one lives in the Arcan Lua API manual and it's called crop_image, and honestly? it's giving "niche but iconic" πŸŽ€


✨ NAME ✨

crop_image β€” crop your image down to the exact dimensions you want, no cap πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

nil
crop_image( width, height )

🌸 DESCRIPTION 🌸

okay so picture this: sometimes the default scale- and resize-function behavior is just... not it. 😭 Especially when you're resizing text β€” any under- or oversampling will rapidly tank the quality, and we simply cannot have that, bestie.

So here's what this function does, fr fr:

  • it acts as a resize down to 1:1 scale for values larger than the initial size
  • it changes effective texture coordinates for values larger than the initial size

and here's the side effect you gotta know about πŸ‘‘: it will revert other texture sampling manipulations like mirroring, and it will reset any pending resize transformation chains. so yeah, it's a bit of a clean-slate queen. πŸ’…


🫢 NOTES 🫢

  1. lowkey there's another way to get the same effect β€” create a null_surface, link the image to this surface, and enable shallow clipping. but ngl, that results in a more complex structure to render and more code to properly set up, so like... why would you 😭

πŸ’œ EXAMPLE πŸ’œ

function crop_image0()
      local img = load_image("test.png");
      local props = image_surface_properties(img);
      crop_image(img, 0.5 * props.width, 0.5 * props.height);
      show_image(img);
end

🧚 EXAMPLE 🧚

function crop_image1()
      local img = render_text([[onts/default.ttf,18      local props = image_surface_properties(img);
      crop_image(img, 0.5 * props.width, 0.5 * props.height);
      show_image(img);
end

🌈 SEE ALSO 🌈

  • image πŸ‘€

and that's the whole vibe, bestie πŸ’– this little icon comes to you from the image corner of the Arcan Lua API, dated October 2026, and yes the footer still says crop_image(3) because tradition is tradition πŸŽ€βœ¨

πŸ“¦ where this page comes from