Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tiff metadata
#2
Hi, I have found

    ######Read metadata on the original file
    fd = open(nfc, 'rb')
    d= fd.read()
    xmp_start = re.search(b'analySIS',d)
    xmp_end = re.search(b'Solutions',d)
    xmp_str = d[:xmp_end.span()[0]+11]
    xmp_str2 = d[xmp_start.span()[0]-16:]
    fd.close()

    ######Write
    img2.save(os.path.join(path2,nom))
    fd = open(os.path.join(path2,nom), 'rb')
    d= fd.read()
    fd.close()
    d=xmp_str+d[140:]+xmp_str2
    fd = open(os.path.join(path2,nom), 'w+b')
    fd.write(d)
    fd.close()
Reply


Messages In This Thread
Tiff metadata - by sudecki - Aug-09-2018, 10:55 AM
RE: Tiff metadata - by sudecki - Aug-10-2018, 07:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question image manipulation (cropping and MetaData) SpongeB0B 4 1,171 Jul-03-2023, 06:35 PM
Last Post: SpongeB0B
  AttributeError: 'function' object has no attribute 'metadata 3lnyn0 5 4,653 Mar-28-2022, 04:42 PM
Last Post: Larz60+
  OCR-Python from Multi TIFF to HOCR getting only Data from 1st Page of multiple TIFF JOE 0 2,169 Feb-18-2022, 03:18 PM
Last Post: JOE
  how to extract tiff images from the subfolder into. hocr format in another similar su JOE 0 1,162 Feb-16-2022, 06:28 PM
Last Post: JOE
  Compressed multi page tiff wvanoeveren 2 2,677 Dec-28-2021, 11:40 AM
Last Post: Gribouillis
  How to open/load image .tiff files > 2 GB ? hobbyist 1 2,472 Aug-19-2021, 12:50 AM
Last Post: Larz60+
  Unable to capture all images of a multipage TIFF file in a merge bendersbender 0 2,223 Nov-19-2020, 03:09 PM
Last Post: bendersbender
  Adding Language metadata to a PDF programmatically bhargavi22 0 1,951 Aug-17-2020, 12:53 PM
Last Post: bhargavi22
  METADATA Errors millpond 0 1,920 Jul-21-2020, 08:22 AM
Last Post: millpond
  Converting PNG to TIFF (pillow?) gw1500se 4 5,529 Mar-25-2020, 06:29 PM
Last Post: gw1500se

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020