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

Sharp convert to jp2 format (JPEG2000) #2245

Closed
hegyre opened this issue Jun 5, 2020 · 8 comments
Closed

Sharp convert to jp2 format (JPEG2000) #2245

hegyre opened this issue Jun 5, 2020 · 8 comments

Comments

@hegyre
Copy link

hegyre commented Jun 5, 2020

Hello,
I'm using latest versions of sharp and libvips

What are you trying to achieve?
I want to convert images like .png to .jp2
I've compiled and installed libvips globally, with imagemagick, itself compiled with jpeg2000 support.

Have you searched for similar questions?
Only found that one from 2018: #1489

Are you able to provide a minimal, standalone code sample that demonstrates this question?
If you could help me understand what should I update in the code to support something like:

sharp(input)
  .toFormat('jp2')
  .toBuffer();

Thanks in advance.

@hegyre hegyre added the question label Jun 5, 2020
@lovell
Copy link
Owner

lovell commented Jun 5, 2020

The work to expose magick-based output has started with PR #2012

@hegyre
Copy link
Author

hegyre commented Jun 5, 2020

OK so it seems that one should adapt that PR #2012 to allow support for additional imagemagick formats (like .jp2)

Thanks for your answer @lovell ! much appreciated.

@LosTigeros
Copy link

LosTigeros commented Feb 25, 2021

So is this finally a thing? I would like to use .toFormat('jp2'). I'd use webp instead but it's not supported everywhere yet so I need to use it with JPEG 2000 as fallback for Safari support.

@lovell
Copy link
Owner

lovell commented Feb 25, 2021

In the same way that #2012 exposed a .gif() function for GIF output via *magick, this will need someone to do similar for .jp2(). Always happy to accept PRs, if you're able.

@inukshuk
Copy link

@lovell with 8.11 jp2 should be supported directly by libvips if compiled with libopenjpeg2, right? I suspect that this will make supporting the a dedicated .jp2() function more straightforward. I'd be happy to take a stab at this, if you would like to see this in included (I could also add openjpeg2 to sharp-libvips if you would like to include it by default).

@lovell
Copy link
Owner

lovell commented Jul 16, 2021

@inukshuk Great, yes please, libvips 8.11.0 added jp2ksave (and jp2kload) so a PR to expose this API is welcome, although I'd prefer not to include openjpeg in the prebuilt binaries.

@hegyre
Copy link
Author

hegyre commented Jul 16, 2021

Hello @lovell ,
Just curious about not including openjpeg in prebuild binaries.
Any specific reason ?
Thanks!

@lovell lovell added this to the v0.29.1 milestone Sep 5, 2021
@lovell
Copy link
Owner

lovell commented Sep 7, 2021

v0.29.1 is now available with support for JP2 when you compile sharp from source using a globally-installed libvips that has been compiled with support for OpenJPEG.

https://sharp.pixelplumbing.com/api-output#jp2

@lovell lovell closed this as completed Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants