-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
having trouble using set #133
Comments
Hello @kayarre, It's a bit confusing -- libvips has two different types of image metadata. Fields like
There are 10 or so of these core properties. They are immutable and you can only set them with
There's a full list here: https://libvips.github.io/pyvips/vimage.html#pyvips.Image.copy All other image metadata is implemented as a set of name-value pairs in a hash table attached to each image. These are very flexible: you can add any type of data. You can see everything attached to an image with
The 10 built-in fields are listed, but after that there are a lot of others. These extra fields can be changed with
But be careful changing them --- I would copy the image first, or you may have problems with caching. You can make new fields too:
Makes a new 64-bit int field. |
Thank you @jcupitt I figured out essentially what you described. The core parts are immutable but any of the others there is no issue. I can do this:
and it gives the correct thing. one weird thing though is that when I add this metadata and then save to tiff file i.e. test.tiffsave("test2.tif", compression = "VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE", vipsheader gives me this
Why does it show the answer is that is there reason Another Question is that it appears that none of the meta data gets written out? |
resolution-unit metadata was not being checked correctly on tiff save, thanks @kayarre see libvips/pyvips#133
Oh no! I think you've found a bug. I pushed a fix, and I now see:
Thanks for pointing out this dumbness. |
As a workaround, you can set the res unit from the args to tiffsave: x.write_to_file("x.tif", resunit="inch") |
In which version has set_type been fixed? |
It's in libvips 8.9.0 onwards. |
using pyvips 2.1.8
I am doing the simple operation from a loaded .svs file
but when I type:
it returns
1.0
is there something I am missing?
I am planning to write the output to a simple tiff format but I am having a hard time figuring out how to include the meta data with the file.
pyvips is a great tool thank you!
After looking through the documentation there appears that the image metadata is immutable, so what is the point of the set method if can't do what a set method normally does?
say I want to add a bunch of different items as metadata?
would I do something like this
or could I do a for loop, probably need check to see if that object exists
The text was updated successfully, but these errors were encountered: