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

embedding lab TIFF to png with alpha channel fails #646

Closed
DaGaMs opened this issue Dec 6, 2016 · 4 comments
Closed

embedding lab TIFF to png with alpha channel fails #646

DaGaMs opened this issue Dec 6, 2016 · 4 comments
Labels
Milestone

Comments

@DaGaMs
Copy link

DaGaMs commented Dec 6, 2016

I'm experiencing a bug with a specific type of tiff file (16bit, lab) when I try to convert it to an thumbnail in RGBA with transparent background. The error message is:

vips_colourspace: no known route from 'multiband' to 'lab'
vips_colourspace: no known route from 'multiband' to 'srgb'

Interestingly, when I set the background to white instead of {r: 0, g: 0, b: 0, a: 0}, the error does not occur, but the background is black instead of white!

I've looked through the previous discussion relating to this error, but couldn't find any clues as to what might be going on with this particular image (i.e. it has an ICC profile, and it's not a GIF)

Here's the original image:
LAB TIFF

The code looks roughly like this:

var resizer = sharp()
  .sequentialRead();

resizer = resizer.resize(width, height)
  .background({r: 0, g: 0, b: 0, a: 0})
  .embed();

resizer = resizer.png();

fileStream
  .pipe(resizer)
  .on("info", (info) => {
    console.log('Read file of size ' + info.size);
  })
  .on("error", (err) => {
    console.error("Error processing image data: " + err);
  })
  .pipe(outputStream);

Installed tool versions:

  • sharp: 0.16.2
  • vips: libvips 8.5.0-Sat Nov 12 18:29:10 UTC 2016
  • GraphicsMagick: 1.3.23

Any help would be much appreciated!

@lovell
Copy link
Owner

lovell commented Dec 7, 2016

Hello, this is the first attempt I'm aware of to process a (CIE)LAB TIFF image using sharp, so congratulations. I'll need to investigate how best to fix/support this.

Is this sample image you've provided either in the public domain or CC licensed as it would make an excellent addition to the test suite?

(As an aside, colourspace handling will be getting a bit of a makeover with #218.)

@lovell lovell added the triage label Dec 7, 2016
@DaGaMs
Copy link
Author

DaGaMs commented Dec 7, 2016 via email

@lovell
Copy link
Owner

lovell commented Dec 11, 2016

Commit d245526 allows the embed (and extend) operations to work with an alpha-transparency background using non-(s)RGB input images.

libvips was unable to determine the colourspace as being LAB+alpha approximately here. Luckily we already know the colourspace so can pass it via the source_space parameter.

In addition, the RGBA colour passed to the background() function had to be converted into the LAB colourspace before the embed operation.

This will be fixed in v0.17.0 - thanks for reporting.

@lovell lovell added bug and removed triage labels Dec 11, 2016
@lovell lovell added this to the v0.17.0 milestone Dec 11, 2016
@lovell
Copy link
Owner

lovell commented Dec 11, 2016

v0.17.0 now available.

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

No branches or pull requests

2 participants