X___ Posted October 30, 2023 Report Posted October 30, 2023 I found this .NET example as a potential path to circumvent requiring to have Python installed to read PNG metadata: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q0000019lbVCAQ&l=en-US Unfortunately, I don't use 2022 (subscription). Would any one be so kind as to down convert it to 2021? Thanks! Quote
ShaunR Posted October 30, 2023 Report Posted October 30, 2023 (edited) Back-saved to 2009 Untitled 1.vi BTW. Snippets don't work on Lavag. Always post the VI. Edited October 30, 2023 by ShaunR Quote
X___ Posted October 30, 2023 Author Report Posted October 30, 2023 (edited) Thanks. I wished I could, but the link I posted only provides the snippet. Edited October 30, 2023 by X___ Quote
X___ Posted October 30, 2023 Author Report Posted October 30, 2023 This is going away from the original topic, but after a bit of trial and error (and prodding of ChatGPT), I came to the conclusion that there is no other way, in order to extract custom metadata from a PNG file, than to write a custom parser, as .NET only provides access to a series of predefined tags: https://learn.microsoft.com/en-us/dotnet/desktop/winforms/advanced/how-to-read-image-metadata?view=netframeworkdesktop-4.8 https://learn.microsoft.com/en-us/dotnet/api/system.drawing.imaging.propertyitem.id?view=dotnet-plat-ext-7.0 There is a third party .NET framework to achieve that goal (https://products.groupdocs.com/metadata/net/extract/png/) but at $1,700 a year per license, I guess the motivation isn't there... Quote
ShaunR Posted October 31, 2023 Report Posted October 31, 2023 Didn't your AI guru suggest exiv2? Quote
X___ Posted October 31, 2023 Author Report Posted October 31, 2023 9 hours ago, ShaunR said: Didn't your AI guru suggest exiv2? No, it did not. It did mention that groupdocs was not free though! What puzzles me is that it did not mention that this was a standard feature of the python PIL package: from PIL import Image import matplotlib.pyplot as plt filename = '/content/drive/MyDrive/my image.png' # point to the image im = Image.open(filename) im.load() plt.imshow(im) plt.show() print(im.info) print('Metadata Field: ', im.info['Metadata Field']) which is probably the approach I will use in my migration to Python experiment. Quote
ShaunR Posted November 1, 2023 Report Posted November 1, 2023 13 hours ago, X___ said: No, it did not. It did mention that groupdocs was not free though! What puzzles me is that it did not mention that this was a standard feature of the python PIL package: from PIL import Image import matplotlib.pyplot as plt filename = '/content/drive/MyDrive/my image.png' # point to the image im = Image.open(filename) im.load() plt.imshow(im) plt.show() print(im.info) print('Metadata Field: ', im.info['Metadata Field']) which is probably the approach I will use in my migration to Python experiment. You've really been gulping down that AI coolade, huh? I was going to mention PIL but IIRC it only supports standard tags (like the .NET that you criticized) so didn't bother to mention it. Quote
X___ Posted November 1, 2023 Author Report Posted November 1, 2023 8 hours ago, ShaunR said: You've really been gulping down that AI coolade, huh? I was going to mention PIL but IIRC it only supports standard tags (like the .NET that you criticized) so didn't bother to mention it. Koolaid? Not really. I like the sifting through stackexchange, distilling it to the necessary stuff and providing link to the source in case of doubts. PIL does return custom metadata (at least text ones) just fine. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.