Click here to Skip to main content
15,916,188 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Saving File as JPEG - Encoding problems Pin
Richard MacCutchan11-Oct-11 0:10
mveRichard MacCutchan11-Oct-11 0:10 
GeneralRe: Saving File as JPEG - Encoding problems Pin
Naniw11-Oct-11 1:08
Naniw11-Oct-11 1:08 
GeneralRe: Saving File as JPEG - Encoding problems Pin
Richard MacCutchan11-Oct-11 5:21
mveRichard MacCutchan11-Oct-11 5:21 
AnswerRe: Saving File as JPEG - Encoding problems Pin
Luc Pattyn11-Oct-11 6:03
sitebuilderLuc Pattyn11-Oct-11 6:03 
GeneralMessage Removed Pin
11-Oct-11 16:29
Naniw11-Oct-11 16:29 
GeneralRe: Saving File as JPEG - Encoding problems Pin
Luc Pattyn11-Oct-11 16:33
sitebuilderLuc Pattyn11-Oct-11 16:33 
GeneralRe: Saving File as JPEG - Encoding problems Pin
Naniw11-Oct-11 16:38
Naniw11-Oct-11 16:38 
GeneralRe: Saving File as JPEG - Encoding problems Pin
Luc Pattyn11-Oct-11 22:33
sitebuilderLuc Pattyn11-Oct-11 22:33 
oh my.

1.
you could have edited the existing message to adapt its formatting, rather than create yet another one, there is an edit widget below each of your posts for you to do so.

2.
when I said you needed to receive and store in a loop, and use the right amount of bytes, I did not imply to deal with one byte at a time; rather something like:
for(;;) {
    byteCount = server->Receive( bytes, bytes->Length, SocketFlags::None);
    if (byteCount<=0) break;
    ambot->Write( bytes, 0, byteCount );    // <<<< here we store what we've got, and nothing more.
}

The performance difference should be quite noticeable.

3.
I'm still not sure about your header, which you are basically swallowing (i.e. showing as if it were text?????, then forgetting). Is it part of the communication, or is it the header part of the image (which you would need to include in the file)?
And is the camera emitting a JPEG format? Most camera's do, if so the very first bytes are likely to be FF D8 FF (these are three bytes represented in hex, not as text characters!), and most likely the bytes 6 through 9 contain 4A 46 49 46.
So check the incoming data (including your "header") for these values: either use a hex editor to see your resulting JPEG file, or adapt your code so you can see the first 10 bytes (in hex) for both the header and the first (or every) data packet you receive. Alternatively, try your code without the receive-and-show-header statements.
OTOH, if the camera does not generate JPEG, storing some other format into a file and give that a JPEG extension is not the way to convert image formats!

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
iSad

GeneralRe: Saving File as JPEG - Encoding problems Pin
Naniw11-Oct-11 1:10
Naniw11-Oct-11 1:10 
AnswerRe: Saving File as JPEG - Encoding problems Pin
Chris Losinger11-Oct-11 3:35
professionalChris Losinger11-Oct-11 3:35 
QuestionRe: Saving File as JPEG - Encoding problems Pin
David Crow11-Oct-11 4:07
David Crow11-Oct-11 4:07 
QuestionSetting a bmp as a window background Pin
jkirkerx10-Oct-11 13:40
professionaljkirkerx10-Oct-11 13:40 
AnswerRe: Setting a bmp as a window background Pin
TheGreatAndPowerfulOz10-Oct-11 14:45
TheGreatAndPowerfulOz10-Oct-11 14:45 
GeneralRe: Setting a bmp as a window background Pin
jkirkerx10-Oct-11 16:01
professionaljkirkerx10-Oct-11 16:01 
GeneralRe: Setting a bmp as a window background Pin
jkirkerx10-Oct-11 16:14
professionaljkirkerx10-Oct-11 16:14 
GeneralRe: Setting a bmp as a window background Pin
Richard MacCutchan10-Oct-11 22:15
mveRichard MacCutchan10-Oct-11 22:15 
GeneralRe: Setting a bmp as a window background Pin
jkirkerx11-Oct-11 7:01
professionaljkirkerx11-Oct-11 7:01 
GeneralRe: Setting a bmp as a window background Pin
Richard MacCutchan11-Oct-11 7:43
mveRichard MacCutchan11-Oct-11 7:43 
GeneralRe: Setting a bmp as a window background Pin
jkirkerx11-Oct-11 8:41
professionaljkirkerx11-Oct-11 8:41 
GeneralRe: Setting a bmp as a window background Pin
Richard MacCutchan11-Oct-11 10:56
mveRichard MacCutchan11-Oct-11 10:56 
GeneralRe: Setting a bmp as a window background Pin
CPallini10-Oct-11 22:28
mveCPallini10-Oct-11 22:28 
GeneralRe: Setting a bmp as a window background Pin
jkirkerx11-Oct-11 7:02
professionaljkirkerx11-Oct-11 7:02 
QuestionCDC::GetDeviceCaps, how to know if AlphaBlend is supported or not? Pin
Code-o-mat10-Oct-11 9:36
Code-o-mat10-Oct-11 9:36 
AnswerRe: CDC::GetDeviceCaps, how to know if AlphaBlend is supported or not? Pin
Richard MacCutchan10-Oct-11 10:26
mveRichard MacCutchan10-Oct-11 10:26 
GeneralRe: CDC::GetDeviceCaps, how to know if AlphaBlend is supported or not? Pin
Code-o-mat10-Oct-11 10:30
Code-o-mat10-Oct-11 10:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.