Code Monkey home page Code Monkey logo

Comments (7)

jcupitt avatar jcupitt commented on June 8, 2024 1

Ah well done! Yes I see a failure too, though only on macOS:

12:21 $ vips tiffsave k2_mono.jpg x.tif --tile --compression jpeg --Q 90
VipsJpeg: Unsupported color conversion request
VipsJpeg: Unsupported color conversion request
VipsJpeg: Unsupported color conversion request
wbuffer_write: write failed
unix error: Unknown error: -1
✘-1 ~/pics 

At a guess, Q>=90 is disabling chroma subsampling, and the very recent libtiff on macOS doesn't like this for greyscale images. I'll investigate.

from libvips.

jcupitt avatar jcupitt commented on June 8, 2024 1

Yes, mozjpeg seems to be missing some of the colourspace conversions that the other libjpeg implementations support. I've changed the way libvips disables chroma subsample for tiff jpeg write and it seems to work now.

This fix will be in 8.15.2, thanks for the report!

from libvips.

jcupitt avatar jcupitt commented on June 8, 2024

Hi @cavenel,

It's working for me:

16:13 $ vips tiffsave k2.jpg x.tif --tile --compression jpeg --Q 90
✔ ~/pics 
16:14 $ which vips
/opt/homebrew/bin/vips
✔ ~/pics 
16:14 $ vips --version
vips-8.15.1
✔ ~/pics 
16:14 $ 

That's an M2 mac mini with homebrew libvips.

Could you perhaps have a non-RGB image in input.tif? You can only save RGB and mono images with JPEG compression.

from libvips.

cavenel avatar cavenel commented on June 8, 2024

Hi @jcupitt,

That is strange, I tried with multiple input files, including jpeg input files (so RGB).
And the fact that it works with a different compression value (like --Q 85) is also confusing.
I will investigate more with other images tomorrow, and share one that fails.

from libvips.

jcupitt avatar jcupitt commented on June 8, 2024

Yes, that is puzzling! That was with brew update && brew upgrade as of an hour ago, if that makes a difference.

from libvips.

cavenel avatar cavenel commented on June 8, 2024

So, after some more testing, it seems like it only fails on grayscale images.
Take any image, open in GIMP, change mode to Grayscale and export as PNG or JPG. Then vips will fail to convert it to tiff with tile and compression bigger or equal to 90.
Here is an example of image that fails:
k2_g
With the command:

vips tiffsave k2_g.jpg x.tif --tile --compression jpeg --Q 90

from libvips.

jcupitt avatar jcupitt commented on June 8, 2024

After some digging, it seems it's mozjpeg that's causing the problem. Here's a dockerfile that fails in the same way on ubuntu 23.20:

https://github.com/jcupitt/docker-builds/tree/master/libvips-mozjpeg-ubuntu23.10

I'll poke a bit more.

from libvips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.