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
Added support for encoding and decoding iTXt chunks. #818
Conversation
Changes Unknown when pulling c469dd9 on dolda2000:itxt into * on python-pillow:master*. |
@dolda2000 Please could you also add tests for this code? Thanks! |
@hugovk Not sure. When I run "setup.py test", it gives me an error:
Is this not how one is supposed to run tests on PIL? I will admit I have no experience with Python's testing framework. |
@dolda2000 You can run them all like this (taken from .travis.yml):
Or with coverage:
include=PIL/* -m nose -vx Tests/test_*.py Or to run just a single test:
Either edit an appropriate existing test file or create a new one if you wish; helper.py has a base test class with helper functions. Test images go in Tests/images/. |
Thanks. I added some tests. Is that something you would be happy with? |
Changes Unknown when pulling 2b4d91e on dolda2000:itxt into * on python-pillow:master*. |
@dolda2000 Yes, that looks the right sort of thing. Please can you also test the new |
Ah, right, of course. Fixed. I also took the opportunity to do it so that Unicode strings with non-Latin1 characters in them are always encoded as iTXt chunks, in order to actually preserve their contents. |
Changes Unknown when pulling 2687b5c on dolda2000:itxt into * on python-pillow:master*. |
@@ -329,6 +362,43 @@ def chunk_zTXt(self, pos, length): | |||
self.im_info[k] = self.im_text[k] = v | |||
return s | |||
|
|||
def chunk_iTXt(self, pos, length): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function uses a lot of single-letter variable names and it's not always clear what they do. Please could you use more descriptive names?
To be fair, I was trying to keep in style with the surrounding chunk_tEXt and chunk_zTXt functions. :) Since they use similar variable naming, I don't quite see what would be better. |
Added support for encoding and decoding iTXt chunks.
Thanks for the contribution! |
No description provided.