search

Home  >  Q&A  >  body text

objective-c - 请问如何实现图片中效果的效果?

更换头像 后面的背景图片跟着头像的颜色更换,但是后面背景图片的颜色比较浅

曾经蜡笔没有小新曾经蜡笔没有小新2758 days ago654

reply all(4)I'll reply

  • 天蓬老师

    天蓬老师2017-05-02 09:25:29

    Use canvas to load images. HTML5 canvas has a getImageData() method to get the color of a pixel at a certain point, and then lighten the color (you can add transparency to the effect), but the point where you get the pixel may not be the color you want.
    I think it’s best to submit it to the server for processing

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:25:29

    Isn’t this a white translucent mask?

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:25:29

    According to what you said, you need to get the main color of the entire picture, and then set the background to be consistent with the main color, but a slightly lighter color. You can use transparency, or you can also reduce the color depth. If your background is a picture, then you have to change the picture according to the color.

    There are quite a few libraries for getting the main color, such as DBImageColorPicker, etc.

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-02 09:25:29

    It should be a translucent mask on top, and what’s underneath the mask is the enlarged avatar

    reply
    0
  • Cancelreply