Comments (2)
Thanks for your reply. This was mostly when thinking about having the option of converting images to jpgs to save space while keeping the metadata.
The solution in your example will suffice to accomplish what I was thinking about 👌
from sd-parsers.
Having looked at your project, i am not sure what exactly you are trying to do, so feel free to correct me when i am going into the wrong direction with this answer.
Generally, i don't see much benefit in adding saving functionality to my library, as the Pillow library handles this pretty well already. Mixing in the sd-parsers library into this is also not a problem, as you can see in the example below:
from PIL import Image
from PIL.PngImagePlugin import PngInfo
from sdparsers import ParserManager
parser = ParserManager()
with Image.open("test.png") as image:
# read data here
data = parser.parse(image)
# do stuff with data
....
# then write some data
if image.format == "PNG":
png_info = PngInfo()
# add the metadata from the opened image
for key, value in image.text.items():
png_info.add_text(key, value)
# then add your custom key
png_info.add_text("my-custom-key", "my-custom-value")
# save
image.save("test_out.png", pnginfo=png_info)
I personally though, would advise against writing metadata back into images in any form if you can avoid it, as (as with any file operation) there is always the chance of something going wrong.
from sd-parsers.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sd-parsers.