2014-01-14 4 views
0

원격 개발자가 SaveToText()라는 VBA 명령을 사용하여 일반 텍스트 파일로 내보내기를 수행하는 이전 Access 2002 양식 집합이 있습니다. 결과 파일은 다음과 유사합니다.Access 2002에서 TIFF 다시 만들기 VBA 내보내기

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 

Microsoft에서 Tiff 데이터를 인코딩하는 방법에 대한 안내서가 있습니까? 그것들은 표준 Tiff 헤더를 완전히 벗겨내는 것처럼 보입니다. 결과 데이터를 이해하지 못해 어떤 이미지 파일 디렉토리도 찾을 수 없습니다.

새 이미지 헤더 및 이미지 파일 디렉토리를 만들기 위해 일부 클래스를 함께 cobble했지만 원래 IFD에서 Tiff 엔터티를 올바르게 검색하는 데 사용되는 인코딩을 결정하고 싶습니다.

답변

0

결과적으로 데이터는 EMF 파일로 포함됩니다. 처음 8 바이트의 데이터를 제거하면 파일의 나머지 부분을 Image 객체로 직접 인스턴스화 할 수 있습니다.

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");