Click here to Skip to main content
15,850,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am trying to make a online streaming service. but when i start converting images from one type to other it shows error.

here is my code

MyBitmapFile myFile = new MyBitmapFile(m_hDevice.ImageSize.Width, m_hDevice.ImageSize.Height, m_Frame);
                    MemoryStream BmpStream = new MemoryStream(myFile.BitmatFileData);
                    Bitmap Bmp = new Bitmap(BmpStream);

this part works fine this is given with api doc.

but when

Image bmp_img = (Image)Bmp;
                    bmp_img.Save(JPG_IAMGE_STREAM, System.Drawing.Imaging.ImageFormat.Jpeg);
                    JPG_IAMGE_STREAM.Seek(0, 0);

the proble is in bmp_img.Save

What I have tried:

when i open this service service exit with error.
no error code.
Updated 9-May-21 20:58pm

1 solution

We can't tell - but the most likely problem is that either JPG_IAMGE_STREAMis a path string and the path is not accessible to a Service because it doesn't run under your User credentials, or it is a Stream that doesn't support Seeking.

Services don't run under the User account: they run under a special account - so they can run before any user logs in. If you try to write to a path that isn't specifically accessible to the Service user, then the write will fail, and the Service will fail.

Check the type of JPG_IAMGE_STREAM and if it's a stream, find out what type, then check if that supports Seek operations - not all do for a variety of reasons. If it;'s a file path, then check exactly where it writes to.

Sorry, but we can't do any of that for you!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900