BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Prefix in Image (Hex Image)

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Ernesto Rod
Guest





PostPosted: Fri May 27, 2005 5:10 am    Post subject: Prefix in Image (Hex Image) Reply with quote




Hi:

I'm using the method supply by Remy Lebeau (TeamB):

const char* hex_chars = "0123456789ABCDEF";

AnsiString __fastcall MemStreamToHex(TMemoryStream *pms)
{
AnsiString Result;

int size = pms->Size;
if( size > 0 )
{
Result.SetLength(size * 2);

BYTE *src = (BYTE*) pms->Memory;
char *dest = Result.c_str();

for(int i = 0, j = 0; i < size; ++i)
{
dest[j++] = hex_chars[(src[i] &0xF0) >> 4];
dest[j++] = hex_chars[src[i] & 0x0F];
}
}

return Result;
}

to convert the image to hex and this is working.

Also, I get the same image using:

TComponent* c;
c = Form1->Image1;
pms1->WriteComponent(c);
pms1->Seek(0, soFromBeginning);
ObjectBinaryToText(pms1, pss);
pss->Seek(0, soFromBeginning);
ass = pss->DataString;

and the hex information is not the same:

In the first case I get:

FFD8FFE000104....

but in the second case I get:

Picture.Data = {0A544A504547496D61676570160000FFD8FFE00010.....

The problem is that in the second case there is a prefix "0A544A504547496D61676570160000" of 30 chars (15 Hex). What is this prefix with the same length (30)?


Back to top
Vladimir Stefanovic
Guest





PostPosted: Fri May 27, 2005 6:14 am    Post subject: Re: Prefix in Image (Hex Image) Reply with quote




Quote:
The problem is that in the second case there is a prefix "0A544A504547496D61676570160000" of 30 chars (15 Hex). What is this prefix with the same length (30)?

It's obviously a 'system' text describing the picture format.
If you exclude first byte (OA) and the last two bytes (0000),
the rest of the bytes interpreted as ASCII means:

TJPEGImagep




Best regards,
Vladimir Stefanovic


Back to top
Vladimir Stefanovic
Guest





PostPosted: Fri May 27, 2005 9:31 am    Post subject: Re: Prefix in Image (Hex Image) Reply with quote




Quote:
If you exclude first byte (OA) and the last two bytes (0000),
the rest of the bytes interpreted as ASCII means:

TJPEGImagep

Correction:

[...] and the last three bytes (160000),
the rest of the bytes interpreted as ASCII means:

TJPEGImage


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri May 27, 2005 5:16 pm    Post subject: Re: Prefix in Image (Hex Image) Reply with quote


"Ernesto Rod" <enriquevald (AT) yahoo (DOT) com> wrote


Quote:
What is this prefix with the same length (30)?

1 BYTE, Length of Class Name (0A = 10)
n BYTES, Class Name (544A504547496D616765 = "TJPEGImage")
Remaining BYTES, Class-specific data

The block of data after the class name is specific to TJPEGImage, and the
contains are unknown because Borland does not provide the source code for
TJPEGImage, so I cannot tell you what they are.


Gambit



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri May 27, 2005 5:16 pm    Post subject: Re: Prefix in Image (Hex Image) Reply with quote


"Vladimir Stefanovic" <antivari (AT) po (DOT) sbb.co.yu> wrote


Quote:
It's obviously a 'system' text describing the picture format.
If you exclude first byte (OA) and the last two bytes (0000),
the rest of the bytes interpreted as ASCII means:

See my other reply.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.