2011-01-04 10 views
3

Clarifiration :VB.NET 이름 바꾸기 파일 및 태그 재 지정/편집 이미지 메타 데이터/메타 태그

어떻게 외부 DLL을 사용하지 않고 편집 및 저장 이미지 EXIF ​​/ 메타 데이터 /에서는 FileInfo합니까?

프로젝트 :

내가 이름을 바꾸 태그 재 지정, 나는 내 개인 웹 사이트에 호스팅 된 이미지의 종말 양을 구성 할 수 개인적인 용도로 응용 프로그램을 짓고 있어요. 필자가 재미있는 그림을 몇 년 동안 수집하고 있기 때문에 파일 명명 규칙에 대한 실제적인 운이나 이유는 없습니다. Ergo, Image0001.jpg는 설명이 포함 된 파일 이름으로 바꿔야하며 메타 데이터 필드는 입력해야합니다.

원하는 프로세스는 기존의 jpg, gif, png, tiff 또는 bmp를 취하여 다음을 수행합니다. imageData의 구조에 (주로, 작은 파일 크기)

  • 로드 이미지 태그를 필요한 경우 메모리에

    1. 로드 이미지가
    2. 은 JPG를에 BMP 파일을 변환
    3. 로드 파일 데이터로 (아래 참조) ImageData S
    4. 는 필드와 파일의 이름을 변경의 편집
    5. 이미지 파일에 변경 사항을 작성할 수의 (a 그림 상자와 여러 텍스트 상자) (필요) tructure
    6. 화면 이미지와 사용자가 편집 태그
    7. 다음 파일로 이동하십시오.

    예 :

    1. 로드 Image0001.jpg. ImageData 구조체 필드를 채 웁니다.
    2. 유형 설명 : "lolcat ceiling cat send son".
    3. ImageData.FileName이 "lolcat-ceiling-cat-sends-son.jpg"로 변경되었습니다.
    4. ImageData.Name, .Keywords, .Title, .Subject 및 .Comments가 "lolcat ceiling cat sends son"으로 변경되었습니다.
    5. 새 파일 이름으로 파일을 저장하고 모든 새 태그 필드를 저장하십시오.

    (나중에, 나는 또한 등의 키워드, 제목, 파일 이름으로 검색 가능하도록 이러한 파일의 온라인 사본에 대한 링크와 참조 데이터베이스를 구축하는 SQL을 사용하는 것입니다,하지만보다 훨씬 쉽게 다른 레이어의 .. 적어도 나에게)이 하나

    문제 :

    는 지금까지 연구의 몇 일이 거의 측정 진행을 굴복 없다. 정보는 분명히 내가 예상치 못한 검색 키워드의 뒤에 숨겨져있어, 내 검색에 사용하지는 못했다. 어떤 도움을 주시면 감사하겠습니다.

    Imports System.IO 
    Imports System.IO.Path 
    Imports System.Drawing.Imaging 
    Imports ImageData '(The Custom Structure below)' 
    '*Also has a project level reference to the dso.dll referenced below.' 
    
    Public Structure ImageData 
         Shared FileAuthorAuthor As String 
         Shared FileAuthorCategory As String 
         Shared FileAuthorComments As String 
         Shared FileAuthorCompany As String 
         Shared FileAuthorDateCreated As DateTime 
         Shared FileAuthorDescription As String 
         Shared FileAuthorHeight As Decimal 
         Shared FileAuthorHeightResolution As Decimal 
         Shared FileAuthorImage As Image 
         Shared FileAuthorKeywords As String 
         Shared FileAuthorName As String 
         Shared FileAuthorPath As String 'URL or IRL' 
         Shared FileAuthorRead As Boolean 
         Shared FileAuthorSubject As String 
         Shared FileAuthorTitle As String 
         Shared FileAuthorType As String 
         Shared FileAuthorWidth As Decimal 
         Shared FileAuthorWidthResolution As Decimal 
    End Structure 'ImageData 
    

    그리고 데이터를 찾기위한 현재의 방법은 다음과 같습니다 :

    현재 코드는 그대로 내가했습니다은 "셋톱 박스"검색 히트

    Shared Function ReadExistingData(ByRef FileWithPath As String) As Boolean 
    
         'Extract the FileName' 
         Dim PathParts As String() = FileWithPath.Split("\") '" 
         Dim FileName As String = PathParts(PathParts.Length - 1) 
         Dim FileParts As String() = FileName.Split(".") 
         Dim FileType As String = FileParts(FileParts.Length - 1) 
    
         'Create an Image object. ' 
         Dim SelectedImage As Bitmap = New Bitmap(FileWithPath) 
    
         'Get the File Info from the Image.' 
         Dim ImageFileInfo As New FileInfo(FileWithPath) 
         Dim dso As DSOFile.OleDocumentProperties 
         dso = New DSOFile.OleDocumentProperties 
         dso.Open(FileWithPath.Trim, True, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess) 
    
         ImageData.FileAuthor = dso.SummaryProperties.Author '* Requires dso.DLL' 
         ImageData.FileCategory = dso.SummaryProperties.Category '* Requires dso.DLL' 
         ImageData.FileComments = dso.SummaryProperties.Comments '* Requires dso.DLL' 
         ImageData.FileCompany = dso.SummaryProperties.Company '* Requires dso.DLL' 
         ImageData.FileDateCreated = ImageFileInfo.CreationTime 
         ImageData.FileDescription = dso.SummaryProperties.Comments '* Requires dso.DLL.' 
         ImageData.FileHeight = SelectedImage.Height 
         ImageData.FileHeightResolution = SelectedImage.VerticalResolution 
         ImageData.FileImage = New Bitmap(FileWithPath) 
         ImageData.FileKeywords = dso.SummaryProperties.Keywords '* Requires dso.DLL' 
         ImageData.FileName = FileName 
         ImageData.FilePath = FileWithPath 
         ImageData.FileRead = ImageFileInfo.IsReadOnly 
         ImageData.FileSubject = dso.SummaryProperties.Subject '* Requires dso.DLL' 
         ImageData.FileTitle = dso.SummaryProperties.Title '* Requires dso.DLL' 
         ImageData.FileType = FileType 
         ImageData.FileWidth = SelectedImage.Width 
         ImageData.FileWidthResolution = SelectedImage.HorizontalResolution 
    
         Return True 
    
    End Function 'ReadExistingData' 
    

    그냥 몇 reviewed :

    • dso.DLL : 매우 유용하지만 바람직하지 않습니다. 외부 DLL이 필요합니다.
      [HTTP : //] www.developerfusion.com/code/5093/retrieving-the-summary-properties-of-a-file/

    • 불완전한 데이터 ~ 내 질문에 대답하지 않습니다
      [HTTP : //]msdn.microsoft.com/en-us/library/xddt0dz7.aspx

    • 외부 DLL 요구
      [HTTP : //] www.codeproject.com/KB/GDI-plus/ImageInfo.aspx

    • 외부 소프트웨어 필요
      [http : //] stackoverflow.com/questio NS/3313474/쓰기 - 메타 - 투 - PNG 이미지 -에 - 순

    • 오래된 데이터 ~의 Visual Studio 2005 및 .NET 2.0
      [HTTP : //] www.codeproject.com/KB/graphics/

    • MetaDataAccess.aspx

      은 BMP로 변환 : 유용한 보이는
      [HTTP : //]

  • +0

    실제로 질문을하지 않았거나 너무 광범위하여 실제로 도움을 원하는 내용을 결정할 수 없습니다. 귀하의 질문은 "어떻게 JPEG에 메타 데이터를 쓸 수 있습니까?"(JPEG 및 TIFF 형식 만 구조화 된 임의 메타 데이터를 지원하며 TIFF는 웹 친화적이지 않습니다.) 개인 문제로 게시물을 해독하여 . –

    +0

    설명 업데이트 됨 –

    답변

    1

    편집이 www.freevbcode.com/ShowCode.Asp?ID=5799 : 이것은 DLL 아니다 라이브러리의 경우 소스 코드를 프로젝트에 복사하고 객체의 새 인스턴스를 만듭니다.

    나는 여기 ExifWorks라는 클래스를 사용 : http://www.codeproject.com/KB/vb/exif_reader.aspx?msg=1813077 그것은

    Dim EX As New ExifWorks(bitmap) 
    Dim dateStr As String = EX.DateTimeOriginal 
    Dim description As String = EX.Description 
    EX.SetPropertyString(ExifWorks.TagNames.ImageDescription, "my description") 
    

    이것은 내가 지금까지 발견 한 가장 쉬운 방법입니다, 사용이 간단합니다. 어떤 문제가 생기면 알려줘.

    +0

    그게 내가 바라던 것 같아. 고맙습니다! 이것처럼 보이는 것은 제가 시작해야 할 모든 것을 갖게 될 것입니다. –

    0
    Dim MyValue As String = "" 
    
        For Each item In PictureBox1.Image.PropertyIdList 
         MyValue = System.Text.Encoding.UTF8.GetString(PictureBox1.Image.GetPropertyItem(item).Value) 
         ListBox1.Items.Add(MyValue) 
        Next 
    
    +0

    이 질문에 대한 답변을 제공하지 않습니다. 충분한 [평판] (https://stackoverflow.com/help/whats-reputation)이 있으면 [모든 게시물에 주석 달기] (https://stackoverflow.com/help/privileges/comment) 할 수 있습니다. 대신, [질문자의 설명이 필요없는 답변을 제공하십시오] (https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can- i-do- 대신). - [리뷰에서] (리뷰/저품절 게시물/16790583) – OmG