-
Notifications
You must be signed in to change notification settings - Fork 23
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
add progressive and copy options as jpegtran supports #19
base: master
Are you sure you want to change the base?
Conversation
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.
Seems like a good idea, I haven't thought about it carefully, only glanced through the code, and made some comments.
Are you still interested in this?
jpegtran/jpegtran_build.py
Outdated
define_macros=[("HAVE_UNSIGNED_CHAR", "1")], | ||
libraries=["jpeg", "turbojpeg"]) | ||
libraries=["jpeg", "turbojpeg"], | ||
library_dirs=["/opt/libjpeg-turbo/lib64"]) |
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.
These /opt/
paths don't look very portable... Why is this change needed?
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.
I didn't notice the hard code. I will fix it.
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.
At the time I added the hardcode, the features of libjpeg-turbo were only available in the dev branch. So I had to manually build a working environment.
So far, I'm still not very sure how to pass the include dir and lib dir to the build script in a more elegant way, i.e. by command line options, if the header and .so files are not in the default system paths, i.e. /usr/include or /usr/lib.
I try to pass it through environment vars JPEG_TURBO_INCLUDE=/opt/libjpeg-turbo/include/ JPEG_TURBO_LIB=/opt/libjpeg-turbo/lib64
. And I try to give them default values as /opt/...
. It seems that libjpeg-turbo is installed in /opt
by default.
jpegtran/lib.py
Outdated
options = self._get_transformoptions() | ||
options.options = lib.TJXOPT_PROGRESSIVE | ||
options.options |= lib.TJXOPT_COPYNONE | ||
return options, 16384 |
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.
I'm not sure what this 16384
means. Maybe it could be documented in a docstring? Note: its forcing flag
to be added elsewhere.
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.
#define TJFLAG_PROGRESSIVE 16384
Thanks for this, but why only COPYNONE? I need COPYALL :-). |
In this libjpeg-turbo/libjpeg-turbo#153 issue, flags and options have been added to the
jpegtran
lib to enable progressive encoding and not copy markers.So I add a corresponding api. Hope it helps.