Ruby
From Wasya Wiki
Install ruby on ubuntu 20
sudo apt update sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Test:
type rbenv
How to render text on image with RMagick and Word wrap?
From: https://stackoverflow.com/questions/11788216/how-to-render-text-on-image-with-rmagick-and-word-wrap
phrase = "my super long text that needs to be auto line breaked and cropped" background = Magick::Image.read('my_bg_img.jpg').first image = Magick::Image.read("caption:#{phrase}") do self.size = '800x600' #Text box size self.background_color = 'none' #transparent self.pointsize = 22 # font size self.font = 'Helvetica' #font family self.fill = 'gray' #font color self.gravity = Magick::CenterGravity #Text orientation end.first background.composite!(image, Magick::NorthEastGravity, 20, 40, Magick::OverCompositeOp) background.format = "jpeg" return background.to_blob