 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ernesto Rod Guest
|
Posted: Fri May 27, 2005 5:10 am Post subject: Prefix in Image (Hex Image) |
|
|
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
|
Posted: Fri May 27, 2005 6:14 am Post subject: Re: Prefix in Image (Hex Image) |
|
|
| 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
|
Posted: Fri May 27, 2005 9:31 am Post subject: Re: Prefix in Image (Hex Image) |
|
|
| 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
|
Posted: Fri May 27, 2005 5:16 pm Post subject: Re: Prefix in Image (Hex Image) |
|
|
"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
|
Posted: Fri May 27, 2005 5:16 pm Post subject: Re: Prefix in Image (Hex Image) |
|
|
"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 |
|
 |
|
|
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
|
|