在 rails 中使用 ImageMagick 的转换选项
Using convert options for ImageMagick in rails
正在进行一个项目,该项目允许将上传的 pdf 转换为 png。到目前为止,这是我得到的:
class MyModel < ActiveRecord::Base
has_attached_file :attachment1,
styles: { image: ["1125x1500", :png] },
default_url: "/images/missing.png",
:convert_options => { density: "1050", quality: "1050" }
{other stuff}
end
convert_options
似乎不起作用,因为调整密度和质量似乎不会对图像产生任何影响。我担心我没有在这里使用正确的语法。
convert_options以key为图片样式,value为选项字符串:
class MyModel < ActiveRecord::Base
has_attached_file :attachment1,
styles: { image: ["1125x1500", :png] },
default_url: "/images/missing.png",
:convert_options => { image: "-density 1050 -quality 1050" }
{other stuff}
end
正在进行一个项目,该项目允许将上传的 pdf 转换为 png。到目前为止,这是我得到的:
class MyModel < ActiveRecord::Base
has_attached_file :attachment1,
styles: { image: ["1125x1500", :png] },
default_url: "/images/missing.png",
:convert_options => { density: "1050", quality: "1050" }
{other stuff}
end
convert_options
似乎不起作用,因为调整密度和质量似乎不会对图像产生任何影响。我担心我没有在这里使用正确的语法。
convert_options以key为图片样式,value为选项字符串:
class MyModel < ActiveRecord::Base
has_attached_file :attachment1,
styles: { image: ["1125x1500", :png] },
default_url: "/images/missing.png",
:convert_options => { image: "-density 1050 -quality 1050" }
{other stuff}
end