문제

I have a set of old Access 2002 forms that a remote developer is performing an export to a flat text file using the VBA command SaveToText(). The resultant file looks something like:

Version =20
VersionRequired =20
Checksum =2050894001
Begin Form
AllowDesignChanges = NotDefault
...
// Other data
...
Begin Image
    Left =420
    Top =2940
    Width =15
    Height =15
    Name ="OnePixelWhite"
    PictureData = Begin
        0x0e000000b23c467d010000006c00000000000000000000000000000000000000 ,
        0x00000000000000001a0000001a00000020454d46000001004403000011000000 ,
        0x010000000000000000000000000000000005000000040000c401000069010000 ,
        0x000000000000000000000000e3e306001c830500460000009401000088010000 ,
        0x4744494301000080000300008e2be2fd0000000070010000010009000003b800 ,
        0x00000000440000000000050000000c0201000100040000000301080005000000 ,
        0x0b0200000000050000000c02010001000f00000026060f0014005f464d524941 ,
        0x21202020202420202020202220201300000026060f001c005f464d5244412020 ,
        0x2020203020202020202020402020215c2f2020204400000026060f007e005f46 ,
        0x4d5246534c205030204823203c213035202c27204521403c202c27203c21403c ,
        0x203827204121203b2050262045213039205025203021303a202c26205421303d ,
        0x202827204521503c205025202f21403b203426203021303a204027204521203b ,
        0x203c25204821303a203027204521402b20302720492140392020202005000000 ,
        0x07010300000005000000090200000000050000000102ffffff0024000000430f ,
        0x2000cc0000000100010000000000010001000000000028000000010000000100 ,
        0x0000010018000000000004000000c40e0000c40e00000000000000000000ffff ,
        0xff00030000000000110000000c000000080000000b0000001000000001000000 ,
        0x0100000009000000100000000100000001000000090000001000000001000000 ,
        0x010000000a000000100000000000000000000000090000001000000001000000 ,
        0x01000000150000000c00000003000000180000000c0000000000000019000000 ,
        0x0c000000ffffff00510000007c00000000000000000000000000000000000000 ,
        0x0000000000000000000000000000000001000000010000005000000028000000 ,
        0x7800000004000000000000002000cc0001000000010000002800000001000000 ,
        0x01000000010018000000000004000000c40e0000c40e00000000000000000000 ,
        0xffffff00250000000c00000007000080250000000c0000000000008030000000 ,
        0x0c0000000f0000804b0000001000000000000000050000000e00000014000000 ,
        0x000000001000000014000000
    End
    Picture ="C:\\Users\\rvallee\\Pictures\\OnePixelWhite.tif"
    GUID = Begin
    0x2ca8b15c250c5f449ef3092a21427c14
End

Does anyone have a guide to how Microsoft encodes the Tiff data? It appears they completely strip off the standard Tiff header, and I can't make sense of the resultant data to find any Image File Directories.

I've managed to cobble together some classes to create a new Image Header and Image File Directory, but I would really like to determine the encoding used to properly retrieve the Tiff entities in the original IFD.

올바른 솔루션이 없습니다

다른 팁

As it turns out, the data is embedded as an EMF file. If we strip off the first 8 bytes of data, the remainder of the file can be directly instantiated as an Image object.

var file = File.ReadAllLines(filePath);
var fileBytes = new List<byte>();
foreach (string line in file)
{
    var numberChars = hex.Length / 2;
    var lineBytes = new byte[numberChars];
    using (var sr = new StringReader(hex))
    {
        for (var i = 0; i < numberChars; i++)
        lineBytes [i] = Convert.ToByte(new string(new[] { (char)sr.Read(), (char)sr.Read() }), 16);
    }
    fileBytes.AddRange(lineBytes);
}
fileBytes.RemoveRange(0, 8);
var ms = new MemoryStream(fileBytes.ToArray());
var image = Image.FromStream(ms);
image.Save("test.emf");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top