Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

samson-wang
Copy link

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.

Copy link
Collaborator

@cbm755 cbm755 left a 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?

define_macros=[("HAVE_UNSIGNED_CHAR", "1")],
libraries=["jpeg", "turbojpeg"])
libraries=["jpeg", "turbojpeg"],
library_dirs=["/opt/libjpeg-turbo/lib64"])
Copy link
Collaborator

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?

Copy link
Author

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.

Copy link
Author

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
Copy link
Collaborator

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mixmastamyk
Copy link

Thanks for this, but why only COPYNONE? I need COPYALL :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants