Skip to content

About using both libjpeg-turbo and mozjpeg #382

@Jehan

Description

@Jehan

Hi! I'm a GIMP developer and mozjpeg came to my attention so I read a bit your various sample, the libjpeg.txt and some blog post.

So if I understood, mozjpeg is targetting web usage and libjpeg-turbo might still be better on another usage. So if I wanted to implement this in GIMP, I would like it to make it an option (like an encoder choice dropdown list), even more as mozjpeg is not available on most distributions anyway (so it can only be an option). The problem is that you implemented it as a drop-in library, which is great if you just want to replace existing encoder/decoder without touching the code, but not if you want to use both, as it means symbol clashes, same lib names, etc.

How would you use both of them in the same binary? Would you try dynamic loading (even this is annoying as you have to play with lib prefixes, etc. because both libs use the same names)?

I mean, even before this, how would you just detect if mozjpeg is available, you only provide a libjpeg.pc and libturbojpeg.pc (so same pkg-config files as the mother project?).

Am I missing something for people who want to use both libraries as they are quite complementary AFAIU.

If not, I would suggest to create a libmozjpeg with its own libmozjpeg.(so|a|pc|h) files. You could still provide a standard libjpeg (which would basically use the libmozjpeg functions but with standard jpeg_ names) on the side.

This would also allow distributions to actually ship mozjpeg without having to decide to drop libjpeg-turbo (they could then only ship the libmozjpeg), and applications to load both mozjpeg (with namespaced mozjpeg_ functions) and another jpeg lib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions