Как в .Net выкапывать свойства и значения из PropertyItems GDI+-совместимого файла?
#38951947
Ссылка:
Ссылка на сообщение:
Ссылка с названием темы:
Ссылка на профиль пользователя:
|
|
|
Ну т.е. втыкаться очевидно как-то так:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.
Dim m_img As Image
Try
m_img = Image.FromFile(sFilename)
GetFileProperties.IsPictureFormat = True
'PropertyCount = m_img.PropertyItems.Count()
'Get the PropertyItems property from image.
Dim propItems As PropertyItem() = m_img.PropertyItems
For Each propItem As PropertyItem In propItems
Debug.Print(propItem.Id & ":" & propItem.Value.ToString) '????????
Next
m_img.Dispose()
Catch
'MsgBox "Not a graphic file!"
End Try
Нужно что: на основании наличия/значений Image_Property_ID_Tags заполнить свою структуру и проанализировать свойства файла.
Пока плаваю в .Net-терминологии.
На чистом GDI+ это простыня, на всяк. случай приложу ее под спойлером (VB6), чтоб было понятно о чем идет речь:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459. 460. 461. 462. 463. 464. 465. 466. 467. 468. 469. 470. 471. 472. 473. 474. 475. 476. 477. 478. 479. 480. 481. 482. 483. 484. 485. 486. 487. 488. 489. 490. 491. 492. 493. 494. 495. 496. 497. 498. 499. 500. 501. 502. 503. 504. 505. 506. 507. 508. 509. 510. 511. 512. 513. 514. 515. 516. 517. 518. 519. 520. 521. 522. 523. 524. 525. 526. 527. 528. 529. 530. 531. 532. 533. 534. 535. 536. 537. 538. 539. 540. 541. 542. 543. 544. 545. 546. 547. 548. 549. 550. 551. 552. 553. 554. 555. 556. 557. 558. 559. 560. 561. 562. 563. 564. 565. 566. 567. 568. 569. 570. 571. 572. 573. 574. 575. 576. 577. 578. 579. 580. 581. 582. 583. 584. 585. 586. 587. 588. 589. 590. 591. 592. 593. 594. 595. 596. 597. 598. 599. 600. 601. 602. 603. 604. 605. 606. 607. 608. 609. 610. 611. 612. 613. 614. 615. 616. 617. 618. 619. 620. 621. 622. 623. 624. 625. 626. 627. 628. 629. 630. 631. 632. 633. 634. 635. 636. 637. 638. 639. 640. 641. 642. 643. 644. 645. 646. 647. 648. 649. 650. 651. 652. 653. 654. 655. 656. 657. 658. 659. 660. 661. 662. 663. 664. 665. 666. 667. 668. 669. 670. 671. 672. 673. 674. 675. 676. 677. 678. 679. 680. 681. 682. 683. 684. 685. 686. 687. 688. 689. 690. 691. 692. 693. 694. 695. 696. 697. 698. 699. 700. 701. 702. 703. 704. 705. 706. 707. 708. 709. 710. 711. 712. 713. 714. 715. 716. 717. 718. 719. 720. 721. 722. 723. 724. 725. 726. 727. 728. 729. 730. 731. 732. 733. 734. 735. 736. 737. 738. 739. 740. 741. 742. 743. 744. 745. 746. 747. 748. 749. 750. 751. 752. 753. 754. 755. 756. 757. 758. 759. 760. 761. 762. 763. 764. 765. 766. 767. 768. 769. 770. 771. 772. 773. 774. 775. 776. 777. 778. 779. 780. 781. 782. 783. 784. 785. 786. 787. 788. 789. 790. 791. 792. 793. 794. 795. 796. 797. 798. 799. 800. 801. 802. 803. 804. 805. 806. 807. 808. 809. 810. 811. 812. 813. 814. 815. 816. 817. 818. 819. 820. 821. 822. 823. 824. 825. 826. 827. 828. 829. 830. 831. 832. 833. 834. 835. 836. 837. 838. 839. 840. 841. 842. 843. 844. 845. 846. 847. 848. 849. 850. 851. 852. 853. 854. 855. 856. 857. 858. 859. 860. 861. 862. 863. 864. 865. 866. 867. 868. 869. 870. 871. 872. 873. 874. 875. 876. 877. 878. 879. 880. 881. 882. 883. 884. 885. 886. 887. 888. 889. 890. 891. 892. 893. 894. 895. 896. 897. 898. 899. 900. 901. 902. 903. 904. 905. 906. 907. 908. 909. 910. 911. 912. 913. 914. 915. 916. 917. 918. 919. 920. 921. 922. 923. 924. 925. 926. 927. 928. 929. 930. 931. 932. 933. 934. 935. 936. 937. 938. 939. 940. 941. 942. 943. 944. 945. 946. 947. 948. 949. 950. 951. 952. 953. 954. 955. 956. 957. 958. 959. 960. 961. 962. 963. 964. 965. 966. 967. 968. 969. 970. 971. 972. 973. 974. 975. 976. 977. 978. 979. 980. 981. 982. 983. 984.
Public Function GetFileProperties(ByVal sFilename As String) As PictureFileProp
Dim retStatus As Status
Dim m_img As Long
Dim PropertyCount As Long
Dim prop As GDIPPropertyItem
Dim i As Long
Dim sItem As String
Dim j As Long
Dim v As Variant
Dim s As String
'...
retStatus = Execute(StartUpGDIPlus(GdiPlusVersion))
If retStatus = OK Then
GdipInitialized = True
Else
Exit Function
End If
retStatus = Execute(GdipLoadImageFromFile(StrPtr(sFilename), m_img))
If retStatus = OK Then
GetFileProperties.IsPictureFormat = True
Call Execute(GdipGetPropertyCount(m_img, PropertyCount))
For i = 1 To PropertyCount
Set prop = PropertyItem(i, PropertyCount, m_img)
sItem = ""
Select Case prop.ItemType
Case PropertyTagTypeASCII
sItem = prop.ParseString()
Case PropertyTagTypeRational, PropertyTagTypeSRational
For j = 1 To prop.ValueCount
If (j > 1) Then
sItem = sItem & ", "
End If
v = prop.ParseRational(j)
'sItem = sItem & v(1) & "/" & v(2)
sItem = sItem & CStr(v(1) / v(2))
Next j
Case PropertyTagTypeLong
For j = 1 To prop.ValueCount
If (j > 1) Then
sItem = sItem & ", "
End If
sItem = sItem & prop.ParseLong(j)
Next j
Case PropertyTagTypeShort
For j = 1 To prop.ValueCount
If (j > 1) Then
sItem = sItem & ", "
End If
sItem = sItem & prop.ParseShort(j)
Next j
Case PropertyTagTypeUndefined
ReDim b(0 To prop.ValueCount - 1) As Byte
prop.GetData b
For j = 1 To prop.ValueCount - 1
If (j > 1) Then
sItem = sItem & " "
End If
s = Hex(b(j - 1))
If Len(s) = 1 Then s = "0" & s
sItem = sItem & s
Next j
Case Else
sItem = sItem & prop.ItemType & " " & prop.length
End Select
If Right(sItem, 1) = Chr(0) Then 'убрать нулевой символ на конце
sItem = Left(sItem, Len(sItem) - 1)
End If
sItem = Trim(sItem) 'на всяк. случай
'заполняем структуру свойствами(если есть требуемые)
With GetFileProperties
Select Case prop.Name
Case "ImageWidth":
.ImageWidth = Val(sItem)
Case "ImageHeight":
.ImageHeight = Val(sItem)
Case "XResolution":
.XResolution = Val(sItem)
Case "YResolution":
.YResolution = Val(sItem)
Case "BitsPerSample":
.BitsPerSample = sItem
Case "Compression":
.Compression = sItem
Case "T4Option":
.T4Option = sItem
Case "T6Option":
.T6Option = sItem
Case "FillOrder":
.FillOrder = sItem
Case Else
End Select
End With
Next i
'...
Else
'MsgBox "Not a graphic file!"
End If
retStatus = Execute(GdipDisposeImage(m_img))
If GdipInitialized = True Then
retStatus = Execute(ShutdownGDIPlus)
End If
End Function
Private Function PropertyItem(ByVal index As Long, ByVal PropertyCount As Long, ByVal m_img As Long) As GDIPPropertyItem
Dim lCount As Long
Dim lPropId() As Long
lCount = PropertyCount
If (index > 0) And (index <= lCount) Then
' Get all property items :
ReDim lPropId(0 To lCount - 1) As Long
Dim lPtrList As Long
lPtrList = VarPtr(lPropId(0))
Call Execute(GdipGetPropertyIdList(m_img, lCount, ByVal lPtrList))
Set PropertyItem = PropertyItemForID(lPropId(index - 1), m_img)
End If
End Function
Private Function PropertyItemForID(ByVal lId As Long, ByVal m_img As Long) As GDIPPropertyItem
Dim lSize As Long
Call Execute(GdipGetPropertyItemSize(m_img, lId, lSize))
If (lSize > 0) Then
ReDim b(0 To lSize - 1) As Byte
Dim lPtrBuff As Long
lPtrBuff = VarPtr(b(0))
Call Execute(LocalGdipGetPropertyItem(m_img, lId, lSize, lPtrBuff))
Dim p As PropertyItem
Dim cItem As New GDIPPropertyItem
Dim lDataSize As Long
If Not (lPtrBuff = 0) And (lSize > 0) Then
CopyMemory p, ByVal lPtrBuff, Len(p)
cItem.fInit p.id, p.length, p.type, p.ValuePtr, lSize
End If
Set PropertyItemForID = cItem
End If
End Function
'=========================
'класс GDIPPropertyItem
Option Explicit
Enum Image_Property_ID_Tags
PropertyTagExifIFD = &H8769
PropertyTagsIFD = &H8825
PropertyTagNewSubfileType = &HFE
PropertyTagSubfileType = &HFF
PropertyTagImageWidth = &H100
PropertyTagImageHeight = &H101
PropertyTagBitsPerSample = &H102
PropertyTagCompression = &H103
PropertyTagPhotometricInterp = &H106
PropertyTagThreshHolding = &H107
PropertyTagCellWidth = &H108
PropertyTagCellHeight = &H109
PropertyTagFillOrder = &H10A
PropertyTagDocumentName = &H10D
PropertyTagImageDescription = &H10E
PropertyTagEquipMake = &H10F
PropertyTagEquipModel = &H110
PropertyTagStripOffsets = &H111
PropertyTagOrientation = &H112
PropertyTagSamplesPerPixel = &H115
PropertyTagRowsPerStrip = &H116
PropertyTagStripBytesCount = &H117
PropertyTagMinSampleValue = &H118
PropertyTagMaxSampleValue = &H119
PropertyTagXResolution = &H11A ' Image resolution in width direction
PropertyTagYResolution = &H11B ' Image resolution in height direction
PropertyTagPlanarConfig = &H11C ' Image data arrangement
PropertyTagPageName = &H11D
PropertyTagXPosition = &H11E
PropertyTagYPosition = &H11F
PropertyTagFreeOffset = &H120
PropertyTagFreeByteCounts = &H121
PropertyTagGrayResponseUnit = &H122
PropertyTagGrayResponseCurve = &H123
PropertyTagT4Option = &H124
PropertyTagT6Option = &H125
PropertyTagResolutionUnit = &H128 ' Unit of X and Y resolution
PropertyTagPageNumber = &H129
PropertyTagTransferFuncition = &H12D
PropertyTagSoftwareUsed = &H131
PropertyTagDateTime = &H132
PropertyTagArtist = &H13B
PropertyTagHostComputer = &H13C
PropertyTagPredictor = &H13D
PropertyTagWhitePoint = &H13E
PropertyTagPrimaryChromaticities = &H13F
PropertyTagColorMap = &H140
PropertyTagHalftoneHints = &H141
PropertyTagTileWidth = &H142
PropertyTagTileLength = &H143
PropertyTagTileOffset = &H144
PropertyTagTileByteCounts = &H145
PropertyTagInkSet = &H14C
PropertyTagInkNames = &H14D
PropertyTagNumberOfInks = &H14E
PropertyTagDotRange = &H150
PropertyTagTargetPrinter = &H151
PropertyTagExtraSamples = &H152
PropertyTagSampleFormat = &H153
PropertyTagSMinSampleValue = &H154
PropertyTagSMaxSampleValue = &H155
PropertyTagTransferRange = &H156
PropertyTagJPEGProc = &H200
PropertyTagJPEGInterFormat = &H201
PropertyTagJPEGInterLength = &H202
PropertyTagJPEGRestartInterval = &H203
PropertyTagJPEGLosslessPredictors = &H205
PropertyTagJPEGPointTransforms = &H206
PropertyTagJPEGQTables = &H207
PropertyTagJPEGDCTables = &H208
PropertyTagJPEGACTables = &H209
PropertyTagYCbCrCoefficients = &H211
PropertyTagYCbCrSubsampling = &H212
PropertyTagYCbCrPositioning = &H213
PropertyTagREFBlackWhite = &H214
PropertyTagICCProfile = &H8773 ' This TAG is defined by ICC
' for embedded ICC in TIFF
PropertyTagGamma = &H301
PropertyTagICCProfileDescriptor = &H302
PropertyTagSRGBRenderingIntent = &H303
PropertyTagImageTitle = &H320
PropertyTagCopyright = &H8298
PropertyTagResolutionXUnit = &H5001
PropertyTagResolutionYUnit = &H5002
PropertyTagResolutionXLengthUnit = &H5003
PropertyTagResolutionYLengthUnit = &H5004
PropertyTagPrintFlags = &H5005
PropertyTagPrintFlagsVersion = &H5006
PropertyTagPrintFlagsCrop = &H5007
PropertyTagPrintFlagsBleedWidth = &H5008
PropertyTagPrintFlagsBleedWidthScale = &H5009
PropertyTagHalftoneLPI = &H500A
PropertyTagHalftoneLPIUnit = &H500B
PropertyTagHalftoneDegree = &H500C
PropertyTagHalftoneShape = &H500D
PropertyTagHalftoneMisc = &H500E
PropertyTagHalftoneScreen = &H500F
PropertyTagJPEGQuality = &H5010
PropertyTagGridSize = &H5011
PropertyTagThumbnailFormat = &H5012 ' 1 = JPEG, 0 = RAW RGB
PropertyTagThumbnailWidth = &H5013
PropertyTagThumbnailHeight = &H5014
PropertyTagThumbnailColorDepth = &H5015
PropertyTagThumbnailPlanes = &H5016
PropertyTagThumbnailRawBytes = &H5017
PropertyTagThumbnailSize = &H5018
PropertyTagThumbnailCompressedSize = &H5019
PropertyTagColorTransferFunction = &H501A
PropertyTagThumbnailData = &H501B
PropertyTagThumbnailImageWidth = &H5020 ' Thumbnail width
PropertyTagThumbnailImageHeight = &H5021 ' Thumbnail height
PropertyTagThumbnailBitsPerSample = &H5022 ' Number of bits per
' component
PropertyTagThumbnailCompression = &H5023 ' Compression Scheme
PropertyTagThumbnailPhotometricInterp = &H5024 ' Pixel composition
PropertyTagThumbnailImageDescription = &H5025 ' Image Tile
PropertyTagThumbnailEquipMake = &H5026 ' Manufacturer of Image
' Input equipment
PropertyTagThumbnailEquipModel = &H5027 ' Model of Image input
' equipment
PropertyTagThumbnailStripOffsets = &H5028 ' Image data location
PropertyTagThumbnailOrientation = &H5029 ' Orientation of image
PropertyTagThumbnailSamplesPerPixel = &H502A ' Number of components
PropertyTagThumbnailRowsPerStrip = &H502B ' Number of rows per strip
PropertyTagThumbnailStripBytesCount = &H502C ' Bytes per compressed
' strip
PropertyTagThumbnailResolutionX = &H502D ' Resolution in width
' direction
PropertyTagThumbnailResolutionY = &H502E ' Resolution in height
' direction
PropertyTagThumbnailPlanarConfig = &H502F ' Image data arrangement
PropertyTagThumbnailResolutionUnit = &H5030 ' Unit of X and Y
' Resolution
PropertyTagThumbnailTransferFunction = &H5031 ' Transfer function
PropertyTagThumbnailSoftwareUsed = &H5032 ' Software used
PropertyTagThumbnailDateTime = &H5033 ' File change date and
' time
PropertyTagThumbnailArtist = &H5034 ' Person who created the
' image
PropertyTagThumbnailWhitePoint = &H5035 ' White point chromaticity
PropertyTagThumbnailPrimaryChromaticities = &H5036
' Chromaticities of
' primaries
PropertyTagThumbnailYCbCrCoefficients = &H5037 ' Color space transforma-
' tion coefficients
PropertyTagThumbnailYCbCrSubsampling = &H5038 ' Subsampling ratio of Y
' to C
PropertyTagThumbnailYCbCrPositioning = &H5039 ' Y and C position
PropertyTagThumbnailRefBlackWhite = &H503A ' Pair of black and white
' reference values
PropertyTagThumbnailCopyRight = &H503B ' CopyRight holder
PropertyTagLuminanceTable = &H5090
PropertyTagChrominanceTable = &H5091
PropertyTagFrameDelay = &H5100
PropertyTagLoopCount = &H5101
PropertyTagPixelUnit = &H5110 ' Unit specifier for pixel/unit
PropertyTagPixelPerUnitX = &H5111 ' Pixels per unit in X
PropertyTagPixelPerUnitY = &H5112 ' Pixels per unit in Y
PropertyTagPaletteHistogram = &H5113 ' Palette histogram
PropertyTagExifExposureTime = &H829A
PropertyTagExifFNumber = &H829D
PropertyTagExifExposureProg = &H8822
PropertyTagExifSpectralSense = &H8824
PropertyTagExifISOSpeed = &H8827
PropertyTagExifOECF = &H8828
PropertyTagExifVer = &H9000
PropertyTagExifDTOrig = &H9003 ' Date & time of original
PropertyTagExifDTDigitized = &H9004 ' Date & time of digital data generation
PropertyTagExifCompConfig = &H9101
PropertyTagExifCompBPP = &H9102
PropertyTagExifShutterSpeed = &H9201
PropertyTagExifAperture = &H9202
PropertyTagExifBrightness = &H9203
PropertyTagExifExposureBias = &H9204
PropertyTagExifMaxAperture = &H9205
PropertyTagExifSubjectDist = &H9206
PropertyTagExifMeteringMode = &H9207
PropertyTagExifLightSource = &H9208
PropertyTagExifFlash = &H9209
PropertyTagExifFocalLength = &H920A
PropertyTagExifMakerNote = &H927C
PropertyTagExifUserComment = &H9286
PropertyTagExifDTSubsec = &H9290 ' Date & Time subseconds
PropertyTagExifDTOrigSS = &H9291 ' Date & Time original subseconds
PropertyTagExifDTDigSS = &H9292 ' Date & TIme digitized subseconds
PropertyTagExifFPXVer = &HA000
PropertyTagExifColorSpace = &HA001
PropertyTagExifPixXDim = &HA002
PropertyTagExifPixYDim = &HA003
PropertyTagExifRelatedWav = &HA004 ' related sound file
PropertyTagExifInterop = &HA005
PropertyTagExifFlashEnergy = &HA20B
PropertyTagExifSpatialFR = &HA20C ' Spatial Frequency Response
PropertyTagExifFocalXRes = &HA20E ' Focal Plane X Resolution
PropertyTagExifFocalYRes = &HA20F ' Focal Plane Y Resolution
PropertyTagExifFocalResUnit = &HA210 ' Focal Plane Resolution Unit
PropertyTagExifSubjectLoc = &HA214
PropertyTagExifExposureIndex = &HA215
PropertyTagExifSensingMethod = &HA217
PropertyTagExifFileSource = &HA300
PropertyTagExifSceneType = &HA301
PropertyTagExifCfaPattern = &HA302
PropertyTagGpsVer = &H0
PropertyTagGpsLatitudeRef = &H1
PropertyTagGpsLatitude = &H2
PropertyTagGpsLongitudeRef = &H3
PropertyTagGpsLongitude = &H4
PropertyTagGpsAltitudeRef = &H5
PropertyTagGpsAltitude = &H6
PropertyTagGpsGpsTime = &H7
PropertyTagGpsGpsSatellites = &H8
PropertyTagGpsGpsStatus = &H9
PropertyTagGpsGpsMeasureMode = &HA
PropertyTagGpsGpsDop = &HB ' Measurement precision
PropertyTagGpsSpeedRef = &HC
PropertyTagGpsSpeed = &HD
PropertyTagGpsTrackRef = &HE
PropertyTagGpsTrack = &HF
PropertyTagGpsImgDirRef = &H10
PropertyTagGpsImgDir = &H11
PropertyTagGpsMapDatum = &H12
PropertyTagGpsDestLatRef = &H13
PropertyTagGpsDestLat = &H14
PropertyTagGpsDestLongRef = &H15
PropertyTagGpsDestLong = &H16
PropertyTagGpsDestBearRef = &H17
PropertyTagGpsDestBear = &H18
PropertyTagGpsDestDistRef = &H19
PropertyTagGpsDestDist = &H1A
End Enum
Private m_lId As Long
Private m_lLength As Long
Private m_itemType As PropertyTagType
Private m_bData() As Byte
Public Property Get id() As Long
id = m_lId
End Property
Public Property Get ItemType() As PropertyTagType
ItemType = m_itemType
End Property
Public Property Get length() As Long
length = m_lLength
End Property
Public Property Get Name() As String
Select Case m_lId
Case PropertyTagExifIFD
Name = "ExifIFD"
Case PropertyTagsIFD
Name = "IFD"
Case PropertyTagNewSubfileType
Name = "NewSubfileType"
Case PropertyTagSubfileType
Name = "TagSubFileType"
Case PropertyTagImageWidth
Name = "ImageWidth"
Case PropertyTagImageHeight
Name = "ImageHeight"
Case PropertyTagBitsPerSample
Name = "BitsPerSample"
Case PropertyTagCompression
Name = "Compression"
Case PropertyTagPhotometricInterp
Name = "PhotometricInterp"
Case PropertyTagThreshHolding
Name = "ThreshHolding"
Case PropertyTagCellWidth
Name = "CellWidth"
Case PropertyTagCellHeight
Name = "CellHeight"
Case PropertyTagFillOrder
Name = "FillOrder"
Case PropertyTagDocumentName
Name = "DocumentName"
Case PropertyTagImageDescription
Name = "ImageDescription"
Case PropertyTagEquipMake
Name = "EquipMake"
Case PropertyTagEquipModel
Name = "EquipModel"
Case PropertyTagStripOffsets
Name = "StripOffsets"
Case PropertyTagOrientation
Name = "Orientation"
Case PropertyTagSamplesPerPixel
Name = "SamplesPerPixel"
Case PropertyTagRowsPerStrip
Name = "RowsPerStrip"
Case PropertyTagStripBytesCount
Name = "StripBytesCount"
Case PropertyTagMinSampleValue
Name = "MinSampleValue"
Case PropertyTagMaxSampleValue
Name = "MaxSampleValue"
Case PropertyTagXResolution
Name = "XResolution"
Case PropertyTagYResolution
Name = "YResolution"
Case PropertyTagPlanarConfig
Name = "PlanarConfig"
Case PropertyTagPageName
Name = "PageName"
Case PropertyTagXPosition
Name = "XPosition"
Case PropertyTagYPosition
Name = "YPosition"
Case PropertyTagFreeOffset
Name = "FreeOffset"
Case PropertyTagFreeByteCounts
Name = "FreeByteCounts"
Case PropertyTagGrayResponseUnit
Name = "GrayResponseUnit"
Case PropertyTagGrayResponseCurve
Name = "GrayResponseCurve"
Case PropertyTagT4Option
Name = "T4Option"
Case PropertyTagT6Option
Name = "T6Option"
Case PropertyTagResolutionUnit
Name = "ResolutionUnit"
Case PropertyTagPageNumber
Name = "PageNumber"
Case PropertyTagTransferFuncition
Name = "TransferFuncition"
Case PropertyTagSoftwareUsed
Name = "SoftwareUsed"
Case PropertyTagDateTime
Name = "DateTime"
Case PropertyTagArtist
Name = "Artist"
Case PropertyTagHostComputer
Name = "HostComputer"
Case PropertyTagPredictor
Name = "Predictor"
Case PropertyTagWhitePoint
Name = "WhitePoint"
Case PropertyTagPrimaryChromaticities
Name = "PrimaryChromaticities"
Case PropertyTagColorMap
Name = "ColorMap"
Case PropertyTagHalftoneHints
Name = "HalftoneHints"
Case PropertyTagTileWidth
Name = "TileWidth"
Case PropertyTagTileLength
Name = "TileLength"
Case PropertyTagTileOffset
Name = "TileOffset"
Case PropertyTagTileByteCounts
Name = "TileByteCounts"
Case PropertyTagInkSet
Name = "InkSet"
Case PropertyTagInkNames
Name = "InkNames"
Case PropertyTagNumberOfInks
Name = "NumberOfInks"
Case PropertyTagDotRange
Name = "DotRange"
Case PropertyTagTargetPrinter
Name = "TargetPrinter"
Case PropertyTagExtraSamples
Name = "ExtraSamples"
Case PropertyTagSampleFormat
Name = "SampleFormat"
Case PropertyTagSMinSampleValue
Name = "SMinSampleValue"
Case PropertyTagSMaxSampleValue
Name = "SMaxSampleValue"
Case PropertyTagTransferRange
Name = "TransferRange"
Case PropertyTagJPEGProc
Name = "JPEGProc"
Case PropertyTagJPEGInterFormat
Name = "JPEGInterFormat"
Case PropertyTagJPEGInterLength
Name = "JPEGInterLength"
Case PropertyTagJPEGRestartInterval
Name = "JPEGRestartInterval"
Case PropertyTagJPEGLosslessPredictors
Name = "JPEGLosslessPredictors"
Case PropertyTagJPEGPointTransforms
Name = "JPEointTransforms"
Case PropertyTagJPEGQTables
Name = "JPEGQTables"
Case PropertyTagJPEGDCTables
Name = "JPEGDCTables"
Case PropertyTagJPEGACTables
Name = "JPEGACTables"
Case PropertyTagYCbCrCoefficients
Name = "YCbCrCoefficients"
Case PropertyTagYCbCrSubsampling
Name = "YCbCrSubsampling"
Case PropertyTagYCbCrPositioning
Name = "YCbCrPositioning"
Case PropertyTagREFBlackWhite
Name = "REFBlackWhite"
Case PropertyTagICCProfile
Name = "ICCProfile"
Case PropertyTagGamma
Name = "Gamma"
Case PropertyTagICCProfileDescriptor
Name = "ICCProfileDescriptor"
Case PropertyTagSRGBRenderingIntent
Name = "SRGBRenderingIntent"
Case PropertyTagImageTitle
Name = "ImageTitle"
Case PropertyTagCopyright
Name = "Copyright"
Case PropertyTagResolutionXUnit
Name = "ResolutionXUnit"
Case PropertyTagResolutionYUnit
Name = "ResolutionYUnit"
Case PropertyTagResolutionXLengthUnit
Name = "ResolutionXLengthUnit"
Case PropertyTagResolutionYLengthUnit
Name = "ResolutionYLengthUnit"
Case PropertyTagPrintFlags
Name = "PrintFlags"
Case PropertyTagPrintFlagsVersion
Name = "PrintFlagsVersion"
Case PropertyTagPrintFlagsCrop
Name = "PrintFlagsCrop"
Case PropertyTagPrintFlagsBleedWidth
Name = "PrintFlagsBleedWidth"
Case PropertyTagPrintFlagsBleedWidthScale
Name = "PrintFlagsBleedWidthScale"
Case PropertyTagHalftoneLPI
Name = "HalftoneLPI"
Case PropertyTagHalftoneLPIUnit
Name = "HalftoneLPIUnit"
Case PropertyTagHalftoneDegree
Name = "HalftoneDegree"
Case PropertyTagHalftoneShape
Name = "HalftoneShape"
Case PropertyTagHalftoneMisc
Name = "HalftoneMisc"
Case PropertyTagHalftoneScreen
Name = "HalftoneScreen"
Case PropertyTagJPEGQuality
Name = "JPEGQuality"
Case PropertyTagGridSize
Name = "GridSize"
Case PropertyTagThumbnailFormat
Name = "ThumbnailFormat"
Case PropertyTagThumbnailWidth
Name = "ThumbnailWidth"
Case PropertyTagThumbnailHeight
Name = "ThumbnailHeight"
Case PropertyTagThumbnailColorDepth
Name = "ThumbnailColorDepth"
Case PropertyTagThumbnailPlanes
Name = "ThumbnailPlanes"
Case PropertyTagThumbnailRawBytes
Name = "ThumbnailRawBytes"
Case PropertyTagThumbnailSize
Name = "ThumbnailSize"
Case PropertyTagThumbnailCompressedSize
Name = "ThumbnailCompressedSize"
Case PropertyTagColorTransferFunction
Name = "ColorTransferFunction"
Case PropertyTagThumbnailData
Name = "ThumbnailData"
Case PropertyTagThumbnailImageWidth
Name = "ThumbnailImageWidth"
Case PropertyTagThumbnailImageHeight
Name = "ThumbnailImageHeight"
Case PropertyTagThumbnailBitsPerSample
Name = "ThumbnailBitsPerSample"
Case PropertyTagThumbnailCompression
Name = "ThumbnailCompression"
Case PropertyTagThumbnailPhotometricInterp
Name = "ThumbnailPhotometricInterp"
Case PropertyTagThumbnailImageDescription
Name = "ThumbnailImageDescription"
Case PropertyTagThumbnailEquipMake
Name = "ThumbnailEquipMake"
Case PropertyTagThumbnailEquipModel
Name = "ThumbnailEquipModel"
Case PropertyTagThumbnailStripOffsets
Name = "ThumbnailStripOffsets"
Case PropertyTagThumbnailOrientation
Name = "ThumbnailOrientation"
Case PropertyTagThumbnailSamplesPerPixel
Name = "ThumbnailSamplesPerPixel"
Case PropertyTagThumbnailRowsPerStrip
Name = "ThumbnailRowsPerStrip"
Case PropertyTagThumbnailStripBytesCount
Name = "ThumbnailStripBytesCount"
Case PropertyTagThumbnailResolutionX
Name = "ThumbnailResolutionX"
Case PropertyTagThumbnailResolutionY
Name = "ThumbnailResolutionY"
Case PropertyTagThumbnailPlanarConfig
Name = "ThumbnailPlanarConfig"
Case PropertyTagThumbnailResolutionUnit
Name = "ThumbnailResolutionUnit"
Case PropertyTagThumbnailTransferFunction
Name = "ThumbnailTransferFunction"
Case PropertyTagThumbnailSoftwareUsed
Name = "ThumbnailSoftwareUsed"
Case PropertyTagThumbnailDateTime
Name = "ThumbnailDateTime"
Case PropertyTagThumbnailArtist
Name = "ThumbnailArtist"
Case PropertyTagThumbnailWhitePoint
Name = "ThumbnailWhitePoint"
Case PropertyTagThumbnailPrimaryChromaticities
Name = "ThumbnailPrimaryChromaticities"
Case PropertyTagThumbnailYCbCrCoefficients
Name = "ThumbnailYCbCrCoefficients"
Case PropertyTagThumbnailYCbCrSubsampling
Name = "ThumbnailYCbCrSubsampling"
Case PropertyTagThumbnailYCbCrPositioning
Name = "ThumbnailYCbCrPositioning"
Case PropertyTagThumbnailRefBlackWhite
Name = "ThumbnailRefBlackWhite"
Case PropertyTagThumbnailCopyRight
Name = "ThumbnailCopyRight"
Case PropertyTagLuminanceTable
Name = "LuminanceTable"
Case PropertyTagChrominanceTable
Name = "ChrominanceTable"
Case PropertyTagFrameDelay
Name = "FrameDelay"
Case PropertyTagLoopCount
Name = "LoopCount"
Case PropertyTagPixelUnit
Name = "PixelUnit"
Case PropertyTagPixelPerUnitX
Name = "PixelPerUnitX"
Case PropertyTagPixelPerUnitY
Name = "PixelPerUnitY"
Case PropertyTagPaletteHistogram
Name = "PaletteHistogram"
Case PropertyTagExifExposureTime
Name = "ExifExposureTime"
Case PropertyTagExifFNumber
Name = "ExifFNumber"
Case PropertyTagExifExposureProg
Name = "ExifExposureProg"
Case PropertyTagExifSpectralSense
Name = "ExifSpectralSense"
Case PropertyTagExifISOSpeed
Name = "ExifISOSpeed"
Case PropertyTagExifOECF
Name = "ExifOECF"
Case PropertyTagExifVer
Name = "ExifVer"
Case PropertyTagExifDTOrig
Name = "ExifDTOrig"
Case PropertyTagExifDTDigitized
Name = "ExifDTDigitized"
Case PropertyTagExifCompConfig
Name = "ExifCompConfig"
Case PropertyTagExifCompBPP
Name = "ExifCompBPP"
Case PropertyTagExifShutterSpeed
Name = "ExifShutterSpeed"
Case PropertyTagExifAperture
Name = "ExifAperture"
Case PropertyTagExifBrightness
Name = "ExifBrightness"
Case PropertyTagExifExposureBias
Name = "ExifExposureBias"
Case PropertyTagExifMaxAperture
Name = "ExifMaxAperture"
Case PropertyTagExifSubjectDist
Name = "ExifSubjectDist"
Case PropertyTagExifMeteringMode
Name = "ExifMeteringMode"
Case PropertyTagExifLightSource
Name = "ExifLightSource"
Case PropertyTagExifFlash
Name = "ExifFlash"
Case PropertyTagExifFocalLength
Name = "ExifFocalLength"
Case PropertyTagExifMakerNote
Name = "ExifMakerNote"
Case PropertyTagExifUserComment
Name = "ExifUserComment"
Case PropertyTagExifDTSubsec
Name = "ExifDTSubsec"
Case PropertyTagExifDTOrigSS
Name = "ExifDTOrigSS"
Case PropertyTagExifDTDigSS
Name = "ExifDTDigSS"
Case PropertyTagExifFPXVer
Name = "ExifFPXVer"
Case PropertyTagExifColorSpace
Name = "ExifColorSpace"
Case PropertyTagExifPixXDim
Name = "ExifPixXDim"
Case PropertyTagExifPixYDim
Name = "ExifPixYDim"
Case PropertyTagExifRelatedWav
Name = "ExifRelatedWav"
Case PropertyTagExifInterop
Name = "ExifInterop"
Case PropertyTagExifFlashEnergy
Name = "ExifFlashEnergy"
Case PropertyTagExifSpatialFR
Name = "ExifSpatialFR"
Case PropertyTagExifFocalXRes
Name = "ExifFocalXRes"
Case PropertyTagExifFocalYRes
Name = "ExifFocalYRes"
Case PropertyTagExifFocalResUnit
Name = "ExifFocalResUnit"
Case PropertyTagExifSubjectLoc
Name = "ExifSubjectLoc"
Case PropertyTagExifExposureIndex
Name = "ExifExposureIndex"
Case PropertyTagExifSensingMethod
Name = "ExifSensingMethod"
Case PropertyTagExifFileSource
Name = "ExifFileSource"
Case PropertyTagExifSceneType
Name = "ExifSceneType"
Case PropertyTagExifCfaPattern
Name = "ExifCfaPattern"
Case PropertyTagGpsVer
Name = "GpsVer"
Case PropertyTagGpsLatitudeRef
Name = "GpsLatitudeRef"
Case PropertyTagGpsLatitude
Name = "GpsLatitude"
Case PropertyTagGpsLongitudeRef
Name = "GpsLongitudeRef"
Case PropertyTagGpsLongitude
Name = "GpsLongitude"
Case PropertyTagGpsAltitudeRef
Name = "GpsAltitudeRef"
Case PropertyTagGpsAltitude
Name = "GpsAltitude"
Case PropertyTagGpsGpsTime
Name = "GpsGpsTime"
Case PropertyTagGpsGpsSatellites
Name = "GpsGpsSatellites"
Case PropertyTagGpsGpsStatus
Name = "GpsGpsStatus"
Case PropertyTagGpsGpsMeasureMode
Name = "GpsGpsMeasureMode"
Case PropertyTagGpsGpsDop
Name = "GpsGpsDop"
Case PropertyTagGpsSpeedRef
Name = "GpsSpeedRef"
Case PropertyTagGpsSpeed
Name = "GpsSpeed"
Case PropertyTagGpsTrackRef
Name = "GpsTrackRef"
Case PropertyTagGpsTrack
Name = "GpsTrack"
Case PropertyTagGpsImgDirRef
Name = "GpsImgDirRef"
Case PropertyTagGpsImgDir
Name = "GpsImgDir"
Case PropertyTagGpsMapDatum
Name = "GpsMapDatum"
Case PropertyTagGpsDestLatRef
Name = "GpsDestLatRef"
Case PropertyTagGpsDestLat
Name = "GpsDestLat"
Case PropertyTagGpsDestLongRef
Name = "GpsDestLongRef"
Case PropertyTagGpsDestLong
Name = "GpsDestLong"
Case PropertyTagGpsDestBearRef
Name = "GpsDestBearRef"
Case PropertyTagGpsDestBear
Name = "GpsDestBear"
Case PropertyTagGpsDestDistRef
Name = "GpsDestDistRef"
Case PropertyTagGpsDestDist
Name = "GpsDestDist"
End Select
End Property
Public Function ValueCount() As Long
Select Case ItemType
Case PropertyTagTypeASCII
' each item is 1 byte:
ValueCount = 1
Case PropertyTagTypeUndefined, PropertyTagTypeByte, 6 ' sbyte
ValueCount = m_lLength
Case PropertyTagTypeShort, 8 ' schar
' each item is 2 bytes:
ValueCount = m_lLength / 2
Case PropertyTagTypeRational, PropertyTagTypeSRational, 12 ' double
' each item is 8 bytes:
ValueCount = m_lLength / 8
Case PropertyTagTypeLong, PropertyTagTypeSLong, 11 ' float
' each item is 4 bytes:
ValueCount = m_lLength / 4
End Select
End Function
Public Property Get ParseString() As String
ParseString = StrConv(m_bData, vbUnicode)
End Property
Public Property Get ParseRational(ByVal lItem As Long) As Variant
Dim lStart As Long
If (lItem > 0) And (lItem <= ValueCount) Then
lStart = (lItem - 1) * 8
ReDim lValue(1 To 2) As Long
CopyMemory lValue(1), m_bData(lStart), 4
CopyMemory lValue(2), m_bData(lStart + 4), 4
ParseRational = lValue
Else
'SetStatusHelper InvalidParameter
End If
End Property
Public Property Get ParseShort(ByVal lItem As Long) As Integer
Dim lStart As Long
If (lItem > 0) And (lItem <= ValueCount) Then
lStart = (lItem - 1) * 2
Dim iRet As Integer
CopyMemory iRet, m_bData(lStart), 2
ParseShort = iRet
Else
'SetStatusHelper InvalidParameter
End If
End Property
Public Property Get ParseLong(ByVal lItem As Long) As Long
Dim lStart As Long
If (lItem > 0) And (lItem <= ValueCount) Then
lStart = (lItem - 1) * 4
Dim iRet As Long
CopyMemory iRet, m_bData(lStart), 4
ParseLong = iRet
Else
'SetStatusHelper InvalidParameter
End If
End Property
Public Sub GetData(ByRef b() As Byte)
Dim i As Long
If (m_lLength > 0) Then
For i = LBound(b) To UBound(b)
b(i) = m_bData(i - LBound(b))
Next i
End If
End Sub
Public Property Get DataBufferSize() As Long
DataBufferSize = ElementDataSize() * m_lLength
End Property
Public Property Get ElementDataSize() As Long
Dim lSize As Long
Select Case ItemType
Case PropertyTagTypeASCII, PropertyTagTypeUndefined, PropertyTagTypeByte, 6 ' sbyte
' each item is 1 byte:
lSize = 1
Case PropertyTagTypeShort, 8 ' schar
' each item is 2 bytes:
lSize = 2
Case PropertyTagTypeRational, PropertyTagTypeSRational, 12 ' double
' each item is 8 bytes:
lSize = 8
Case PropertyTagTypeLong, PropertyTagTypeSLong, 11 ' float
' each item is 4 bytes:
lSize = 4
End Select
ElementDataSize = lSize
End Property
Public Sub Create( _
ByVal lId As Long, _
ByVal lLength As Long, _
ByVal eItemType As PropertyTagType, _
ByRef b() As Byte _
)
Dim i As Long
m_lId = lId
m_lLength = lLength
m_itemType = eItemType
If (m_lLength > 0) Then
ReDim m_bData(LBound(b) To UBound(b))
For i = LBound(b) To UBound(b)
m_bData(i - LBound(b)) = b(i)
Next i
End If
End Sub
Friend Sub fInit( _
ByVal lId As Long, _
ByVal lLength As Long, _
ByVal eItemType As PropertyTagType, _
ByVal lPtr As Long, _
ByVal lSize As Long _
)
m_lId = lId
m_lLength = lLength
m_itemType = eItemType
If Not (lPtr = 0) And (lLength > 0) Then
Dim lDataSize As Long
lDataSize = lSize - 16
If (lDataSize > 0) Then
ReDim m_bData(0 To lDataSize - 1) As Byte
CopyMemory m_bData(0), ByVal lPtr, lDataSize
End If
End If
End Sub
Ну т.е. грубо, мне нужно пробежаться по всем PropertyItem и заполнить свою структуру несколькими интересуемыми свойствами
Моя структура грубо такая:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.
<StructLayout(LayoutKind.Sequential)>
Public Structure PictureFileProp
Dim ImageWidth As Integer '1728
Dim ImageHeight As Integer '2340 1171
Dim XResolution As Single '204
Dim YResolution As Single '196 98
Dim BitsPerSample As String '1 для ч/б
Dim Compression As String
Dim T4Option As String
Dim T6Option As String
Dim FillOrder As String
...
End Structure
Нужен какой-то хороший пример на .Net который копает PropertyItem на предмет Имя(Tag)/Type/Value.
В оф.документации пока не нашел.
|
|