none
[UWP][C#] Lumia Imagin SDK not apply effect to Image? RRS feed

Answers

  • Hi, Nguyen_Thanh_Liem

    >>Lumia Imaging SDK not apply effect to Image?

    First thank you for you code provided to us because it saves a lot of time.

    I made a sample about Lumia Imaging SDK using your code. When I launch the app and choose a picture to change for the first time, it really looks like the picture didn’t change.

     I look through the code and find the place you call the “ApplyEffectAsync” method. Then I changed the type “Color Boost” to “Antique” and test again. This time the SDK worked correctly and the picture was changed. I tried several different types and they all worked correctly. So I think the SDK is working correctly and the “Color Boost” type is also working too.

    I find the document of “Color Boost” class and it solves the problem. Please look at this document:

    https://msdn.microsoft.com/en-us/library/lumia.imaging.adjustments.colorboosteffect_properties.aspx

    The “Color Boost” class has a property called “Gain” and the Description says “The color boost gain level.Range [-1.0, 20.0]. Negative values reduce the colors.”  You should set the value of Gain property so the picture could be changed according to the value.

    It’s simple to set it in the code:

    ColorBoostEffect _colorBoostEffect = new ColorBoostEffect();               
    _colorBoostEffect.Gain = 5;
    

    After this, you can see the obviously changed of the selected picture using ”Color Boost” type.

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 29, 2017 8:00 AM
    Moderator
  • Hi Nguyen_Thanh_Liem,

    You could use the SelectionChanged method of the AdaptiveGridView instead of the ItemClick method.

    In the Xaml file, add the selectionChanged event like this:

    <controls:AdaptiveGridView x:Name="gvEffect"
                                       OneRowModeEnabled="True"   
                                       ItemHeight="100"
                                       DesiredWidth="100"
                                       SelectionMode="None"
                                       IsItemClickEnabled="True"
                                       SelectionChanged="gvEffect_SelectionChanged"
                                       ItemTemplate="{StaticResource PhotosTemplate}"/>
    

    And then create the method in the cs file like this(which can be created automatically by the VS):

    private void gvEffect_SelectionChanged(object sender, SelectionChangedEventArgs e)
          {
    
          }
    

    At last you could add your code into the gvEffect_SelectionChanged method and it will receive the selected item value:

    var seletectedItem = gvEffect.SelectedItem as EffectItem;

    Best Regards,

    Xavier Eoro




    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 6, 2017 7:10 AM
    Moderator

All replies

  • Hi, Nguyen_Thanh_Liem

    >>Lumia Imaging SDK not apply effect to Image?

    First thank you for you code provided to us because it saves a lot of time.

    I made a sample about Lumia Imaging SDK using your code. When I launch the app and choose a picture to change for the first time, it really looks like the picture didn’t change.

     I look through the code and find the place you call the “ApplyEffectAsync” method. Then I changed the type “Color Boost” to “Antique” and test again. This time the SDK worked correctly and the picture was changed. I tried several different types and they all worked correctly. So I think the SDK is working correctly and the “Color Boost” type is also working too.

    I find the document of “Color Boost” class and it solves the problem. Please look at this document:

    https://msdn.microsoft.com/en-us/library/lumia.imaging.adjustments.colorboosteffect_properties.aspx

    The “Color Boost” class has a property called “Gain” and the Description says “The color boost gain level.Range [-1.0, 20.0]. Negative values reduce the colors.”  You should set the value of Gain property so the picture could be changed according to the value.

    It’s simple to set it in the code:

    ColorBoostEffect _colorBoostEffect = new ColorBoostEffect();               
    _colorBoostEffect.Gain = 5;
    

    After this, you can see the obviously changed of the selected picture using ”Color Boost” type.

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 29, 2017 8:00 AM
    Moderator
  • It's always return null when click on item in GridViewEffect

    var seletectedItem = gvEffect.SelectedItem as EffectItem;

    Tuesday, June 6, 2017 5:45 AM
  • Hi Nguyen_Thanh_Liem,

    You could use the SelectionChanged method of the AdaptiveGridView instead of the ItemClick method.

    In the Xaml file, add the selectionChanged event like this:

    <controls:AdaptiveGridView x:Name="gvEffect"
                                       OneRowModeEnabled="True"   
                                       ItemHeight="100"
                                       DesiredWidth="100"
                                       SelectionMode="None"
                                       IsItemClickEnabled="True"
                                       SelectionChanged="gvEffect_SelectionChanged"
                                       ItemTemplate="{StaticResource PhotosTemplate}"/>
    

    And then create the method in the cs file like this(which can be created automatically by the VS):

    private void gvEffect_SelectionChanged(object sender, SelectionChangedEventArgs e)
          {
    
          }
    

    At last you could add your code into the gvEffect_SelectionChanged method and it will receive the selected item value:

    var seletectedItem = gvEffect.SelectedItem as EffectItem;

    Best Regards,

    Xavier Eoro




    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 6, 2017 7:10 AM
    Moderator