×

Discussion Board

Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 41
  1. #16
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    417

    Re: Merge two images

    You need to control marvin's position and scale?

  2. #17
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Re: Merge two images

    no scale, only position.

  3. #18
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Re: Merge two images

    also position is not important.
    I can create two images with the same size, the top image has transparency. (like marvin)

    Simply put marvin over the background :-)

  4. #19
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    417

    Re: Merge two images

    So it's most simple ^^
    Can show a picture of the sort of "ghost" effect?
    How do you decode the png picture? With SDK or With a writeableBitmap?

  5. #20
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Re: Merge two images

    Quote Originally Posted by yan_ View Post
    So it's most simple ^^
    Can show a picture of the sort of "ghost" effect?
    Unfortunately I'm at work, I haven't an example image

    I decode the png picture with an extension method of writeableBitmap, if there is a way to decode with image SDK I prefer use it

  6. #21
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    417

    Re: Merge two images

    in fact, writeablebitmap pixel are premultiplied ARGB. It a possible reason for you ghost effect because sdk will apply alpha a second times. To decode with SDK you do normally like a jpeg file. I'll check later with your picture.

  7. #22
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Re: Merge two images

    You can find in my SkyDrive two new image.
    They are the result of Blend function in my application, one with Add option and the second with Overlay option

    http://sdrv.ms/HISeGi

  8. #23
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    417

    Re: Merge two images

    Strange, i haven't find a direct method to blend with the alpha layer

    So i've extract the alpha layer and use CreateImageFusionFilter
    Code:
    using (var session_bg = await EditingSessionFactory.CreateEditingSessionAsync(storageFile_bg))
                using (var session_top = await EditingSessionFactory.CreateEditingSessionAsync(storageFile_top))
                {
                    //top pixel buffer
                    var pixels = new int[(int)(session_top.Dimensions.Width * session_top.Dimensions.Height)];
                    var bmp = new Bitmap(session_top.Dimensions, ColorMode.Bgra8888, (uint)(4 * session_top.Dimensions.Width), pixels.AsBuffer());
                    //decode png file
                    await session_top.RenderToBitmapAsync(bmp);
    
                    //alpha layer
                    var pixels_alpha = new byte[pixels.Length];
                    var bmp_alpha = new Bitmap(session_top.Dimensions, ColorMode.Gray8, (uint)(session_top.Dimensions.Width), pixels_alpha.AsBuffer());
    
                    //extract alpha
                    for (int i = 0; i < pixels_alpha.Length; ++i)
                        pixels_alpha[i] = (byte)(pixels[i] >> 24);
    
                    //use Image fusion
                    session_bg.AddFilter(FilterFactory.CreateImageFusionFilter(bmp, bmp_alpha, false));
                    await session_bg.RenderToImageAsync(display);
                }
    You can find a sample here :PhoneAppblend.zip
    Last edited by yan_; 2013-11-07 at 20:43.

  9. #24
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Re: Merge two images

    Thank you very much yan, I'll try your code as soon as I can.
    If I correctly understand your code you create the mask for image fusion using the alpha values of the top image, right?

    In fact is a smart solution.
    Thanks again

  10. #25
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    417

    Re: Merge two images

    Quote Originally Posted by DamMen View Post
    Thank you very much yan, I'll try your code as soon as I can.
    If I correctly understand your code you create the mask for image fusion using the alpha values of the top image, right?
    Yes. And i decode images with SDK. So i'm sure to have ARGB pixels and not premultiplied_ARGB for the png images.
    One point, i don't use WriteableBitmap in the code only array.

    I things it's just a missing and i hope normal alpha blending will add in the future.

  11. #26
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Re: Merge two images

    Ok, now it's clear.
    Thanks, your help was indispensable.

  12. #27
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    417

    Re: Merge two images

    If i understand correctly, you want do it in a background agent.
    Like background agent must use limited ressource (CPU, RAM and time), i'm curious if SDK help.
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  13. #28
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Re: Merge two images

    Quote Originally Posted by yan_ View Post
    Like background agent must use limited ressource (CPU, RAM and time), i'm curious if SDK help.
    Yes, it's a challenge. I have to download image from the net and merge with png.

    Today I'm very busy but I'll definitely try tomorrow.
    I'll keep you updated on results

  14. #29
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Re: Merge two images

    Ok, one good news...all work perfectly on app.

    Bad news... the instruction await session_top.RenderToBitmapAsync(bmp); throw an exception when executed in the background agents
    In the Output window I get this error
    The program '[3560] HeadlessHost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.

  15. #30
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    417

    Re: Merge two images

    The code works in application but not in the background agent?
    Last edited by yan_; 2013-11-09 at 12:56.
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. How to take screenshot or merge several images
    By PhoneSoulPL in forum Nokia N9
    Replies: 6
    Last Post: 2011-12-21, 09:16
  2. How to merge image?
    By shrawan0786 in forum Geolocation and Navigation
    Replies: 4
    Last Post: 2010-05-03, 08:22
  3. Is it possible to merge two or more DLLs into one?
    By mak_tgi in forum Symbian C++
    Replies: 1
    Last Post: 2009-03-16, 17:19
  4. Merge SIS problem
    By neil.young in forum Python
    Replies: 9
    Last Post: 2008-10-11, 12:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •