Delpin Susai Raj Sunday 2 February 2020

Xamarin.Forms - Tint Image Color Using Effects

In this blog post, you will learn how to Change image color using Tint Color Effects in Xamarin.Forms.

Introduction

Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files are most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app.

Tint Color

TintImage is used for change image color at runtime with the help of effects, you can achieve with custom render also. Tint images mainly used for reducing the usage of the images.

Prerequisites
  • Visual Studio 2017 or later (Windows or Mac)
Create TintImage

The Actual Image Color is Blue 

Now, Create a TintImage class inherit from RoutingEffect for Change image color.

TintImage.cs

Android Implementation

Here, Implement Platform Effects for TintImage at Runtime.

TintImageImpl.cs

iOS Implementation

Here, Implement Platform Effects for TintImage at Runtime.

TintImageImpl.cs

Consuming the TintImage

Now, Use the TintImage Effect in your XAML code.

MainPage.xaml

Click the "Play" button to try it out.

Wow, It's Working.😍

I hope you have understood how to Change image color using Tint Color Effects in Xamarin.Forms.

Thanks for reading. Please share your comments and feedback. Happy Coding 😀🙌

9 comments:

  1. Hello, first of all thank you for posting this information, but i am hoping u could help me with an problem, when trying to replicate the result with your code, i have run into an issue on the xaml part where it keeps telling me it is unable to find TintColor in TintImageEffect, is this due to an file i am missing from an previous guide or did i mess up my namespaces?

    ReplyDelete
    Replies
    1. I also had this issue, some googling lead me to find https://www.c-sharpcorner.com/article/xamarin-forms-use-bindableproperty-in-effects/ . The missing class is there.

      Delete
  2. Amazing work, So if you need any online converter then use this;

    Converter Files

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Product prototyping during this lockdown period everyone can use it wisely.
    icp-cat training

    ReplyDelete
  5. Great Article
    Image Processing Projects




    Deep Learning Projects for Final Year




    JavaScript Training in Chennai



    JavaScript

    Training in Chennai




    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals,

    Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer.

    Angular Training

    ReplyDelete
  6. Great post, you have pointed out some fantastic points , I likewise think this s a very wonderful website. colorize a picture

    ReplyDelete