图片服务 – thumbor设置背景色

  • Post author:
  • Post category:其他


图片服务 – thumbor设置背景色




背景颜色



用法:background_color(颜色)



说明



background_color过滤器将背景图层设置为指定的颜色。这在将透明图像(PNG)转换为JPEG时特别有用



参数



  • color – 颜色名称(如HTML中)或不带“#”字符的十六进制rgb表达式( 例如,请参阅

    https://en.wikipedia.org/wiki/Web_colors

    )。如果颜色为“自动”,则将巧妙地选择颜色(基于图像像素)作为填充颜色。



示例



原始图片是:

Original picture

http://localhost:8888/unsafe/fit-in/300x300/filters:background_color(blue)/https://github.com/thumbor/thumbor/wiki/dice_transparent_background.png

Picture after the background_color(blue) filter

http://localhost:8888/unsafe/fit-in/300x300/filters:background_color(f00)/https://github.com/thumbor/thumbor/wiki/dice_transparent_background.png

Picture after the background_color(f00) filter

http://localhost:8888/unsafe/fit-in/300x300/filters:background_color(add8e6)/https://github.com/thumbor/thumbor/wiki/dice_transparent_background.png

Picture after the background_color(add8e6)