none
Lumia Imaging SDK - cropping RRS feed

  • Question

  • hi again,

    I'm not exactly sure how to start on using the lumia SDK. There isn't a lot of documentation on this.

    How can I get the photo crop control on my app, then save that image? using c#

    Wednesday, May 11, 2016 12:34 AM

Answers

  • Hi Will

    A good starting point for the Lumia SDK is https://msdn.microsoft.com/en-za/library/mt598507.aspx this covers the core of how the Lumia SDK is structured to work. There are some samples located here - https://msdn.microsoft.com/en-za/library/mt598511.aspx.

    The crop filter details can be found here - https://msdn.microsoft.com/en-us/library/lumia.imaging.transforms.cropfilter.aspx - This crops an image to a specific region

    using (var filterEffect = new FilterEffect(source))
    {
        // Initialize the filter and add the filter to the FilterEffect collection
        var filter = new CropFilter(new Windows.Foundation.Rect( 260, 210, 670, 446));
    
        filterEffect.Filters = new IFilter[] { filter };
    
        // Create a target where the filtered image will be rendered to
        var target = new WriteableBitmap(width, height);
    
        // Create a new renderer which outputs WriteableBitmaps
        using (var renderer = new WriteableBitmapRenderer(filterEffect, target))
        {
            // Render the image with the filter(s)
            await renderer.RenderAsync();
    
            // Set the output image to Image control as a source
            ImageControl.Source = target;
        }
    
        await SaveEffectAsync(filterEffect, "CropFilter.jpg", outputImageSize);
    }
    

    I hope this helps.

    Kind Regards

    Dave

    Wednesday, May 11, 2016 10:03 AM