Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9146827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:50:20+00:00 2026-06-17T10:50:20+00:00

I working on windows phone 7 camera app.I need to convert captured stream ,fix

  • 0

I working on windows phone 7 camera app.I need to convert captured stream ,fix it rotation using exif helper and save as jpeg with quality,orientation,output size parameters.I followed exif rotation article to fix rotation. But the core problem is I need to decode the stream to jpeg first and then perform rotation fix as mentioned in order to save picture to media library.

I use following code:

private WriteableBitmap DecodeImage(Stream photo, int angle)
 {
            WriteableBitmap source = PictureDecoder.DecodeJpeg(photo);

            photo.Seek(0, SeekOrigin.Begin);           

            System.GC.Collect();

            UiDispatcher.BeginInvoke(() =>
            {
                MessageBox.Show(App.LogMemory("after decode"));
            });
            switch (angle)
            {
                case 90:
                case 270:
                    return RotateBitmap(source, source.PixelHeight,
                        source.PixelWidth, angle);
                case 180:
                    return RotateBitmap(source, source.PixelWidth,
                        source.PixelHeight, angle);
                default:
                    return source;
            }
            return null;
        }

In RotateBitMap method i have the rotation logic as specified in link but it creates a new
WritableBitmap object from source as follows:

WritablBitmap target = new WritableBitmap(soure.width,source.height); //source is the bitmap passed in argument.

The problem is

PictureDecoder.decodejpeg –consumes 30 mb for my camera captured stream
and creation of the new bitmap in rotate stream method is consuming 30 mb more.Resulting in hike of 60 mb application memory.

this is causing application crash due to memory in lower end(256mb) windows phone devices.
Why is decoding jpeg take 30mb and rotation of stream 30mb.(I tried to source and target bitmaps in rotate stream method to null and forced gc but were of no use.Applications hardly get 60mb on devices.How can i cope up with this requirement??

Any ideas..?How to optimize memory consumption in these cases???

Note: I need to take bitmap from rotatestream method as result as I need to use that bitmap to save as jpeg with output size,quality.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:50:22+00:00Added an answer on June 17, 2026 at 10:50 am

    When you use JPEG decoding, you usually end up with a photo in it’s full size.
    In case it was taken with 8MP (roughly 8000000 pixels) camera, the calculation is this:

    8000000 * 32bits = 256 000 000 bits for one picture in memory (which is roughly around 30MB)

    (let me remind you that the HTC Titan II has a camera of 16MP, so if you used a photo in full size, it would take up roughly around 62MB in memory!!)

    Obviously, to create just one WriteableBitmap, you need 30MB. In order to manipulate the photo in some way, you usually can’t do it in place. In other words, you need to create a copy, and that’s why it duplicates. Windows Phone has a way of preventing such a big memory consumption by automatically lowering the resolution of the loaded picture, but only when you use it with BitmapImage and SetSource method which takes JPEG stream as a parameter.

    I wrote about it some time ago in my article How to open and work with large photos on Windows Phone and it’s mentioned in the performance considerations for Windows Phone

    So, basically, you should cut down the size of the loaded photo (do you need it in full size anyway?) and the BitmapImage class can easily do it for you automatically keeping it under 2000×2000 px which is roughly 15MB (MAX), so you should be fine if you don’t want to be bothered with that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Windows Phone app using Silverlight C# and XAML. My page
I'm working on a Windows Phone 7 app using WCF for communications with my
Hi I am working in windows 7 phone based app using silverlight. I have
I am working on an windows phone 8 app. I have to save video
I am working on a Windows Phone 7 app and I want to give
I'm working on an App on the windows phone which is very sound, heavy,
I am working on an app on Windows Phone and trying to get data
I am working on a windows phone app (really big one) that has at
I developed an app that is working fine on windows phone. The nature of
Working wth live tiles in my Windows Phone 7 app and it's working quite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.