Tag: 图像

RMagick从图像中删除白色背景并使其透明

我需要从此图像中删除白色背景并使背景透明。 所以它只是透明背景上的黑色刻度,导出为png。 转过来 成 有任何想法吗?

Ruby on Rails显示半个星级的小数等级,例如4.5

我可以查看5个星号,一个产品的评级为5,等级为4的4个星号等。但我想做的是用我的资产中的星星图像替换星号/图像/目录,如果评级为4.5,则显示半个星。 有办法做到这一点吗? 下面是我在application_helper.rb中的当前代码和index.html.erb中的视图。 application_helper.rb: module ApplicationHelper def render_stars(value) output = ” if (1..5).include?(value.to_i) value.to_i.times { output += ‘*’} end output end end index.html.erb: Star rating: