Link to home
Start Free TrialLog in
Avatar of mastiSoft
mastiSoft

asked on

WriteableBitmap problem

HI.
I need to get save a writable bitmap as jpg for example . In my application I create a few writable bitmaps, but I show only one and user can choose if he will load another writable bitmap. To do that I think I need to create an list with path to all writable bitmaps ( or created jpg files, I don't know) and for that I have to save them somewhere.
Do you have any idea how to do that?
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Post some code please
Avatar of mastiSoft
mastiSoft

ASKER

for (int j=0; j<AmountFiles; j++) // it can be upp to 16 files
{
// get data from the data file with path
       using (FileStream fs = File.OpenRead(t_path))
            {
                using (BinaryReader binaryReader = new BinaryReader(fs))
                {

                    Data16 = binaryReader.ReadBytes(size);
                         }
                fs.Close();
                fs.Dispose();
            }
              var bitmap = new WriteableBitmap(width, height, 96, 96, PixelFormats.Indexed8, myPalette);
             stride = ((width * bitmap.Format.BitsPerPixel) + (width % 4));                      
             image_data = new byte[(int)(height * stride)]; // Set the dimensions of the IMAGE ARRAY declared above

            // some function here that setpixel to image_data
           
                   bitmap.WritePixels(new Int32Rect(0, 0, width, height), image_data, (int)stride, 0); //pay attantion when we use Palette then color have to be send as "0"
                        var rotatedImage = new TransformedBitmap(bitmap, new RotateTransform(90));
                     MyImage.Source = rotatedImage; //redraws every time new trace loads // this is works but all images overwrite each others and shows one after another in MyImage (


//somewhere here I have to do something to save path to the created files in List . This is needs to load all images in the list box
// for user select one of them
}
ASKER CERTIFIED SOLUTION
Avatar of mastiSoft
mastiSoft

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi mastiSoft

Sorry I missed your comment. I was oversees when you replied
I put the question on April and now in June I found the solution. No one of the expert gives any answer to my request.