question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stats() on CMYK image: vips_colourspace: no known route from 'cmyk' to 'b-w'

See original GitHub issue

The following code (with a CMYK JPEG as input) gives the error outlined below:

const sharp = require('sharp')
sharp('cmyk.jpg')
  .stats()
  .then(res => console.log('SUCCESS', res))
  .catch(err => console.error('ERROR', err))

Output:

ERROR [Error: vips_colourspace: no known route from 'cmyk' to 'b-w']

The following seems to work:

const sharp = require('sharp')
sharp('cmyk.jpg')
  .toColorspace('srgb')
  .toBuffer()
  .then(res => sharp(res).stats())
  .then(res => console.log('SUCCESS', res))
  .catch(err => console.error('ERROR', err))

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, Jul 29, 2019

sharp v0.23.0 / libvips v8.8.1 is now available.

0reactions
sebastienbarrecommented, Apr 11, 2020

Hi. Sorry to chime-in that late, but I can’t get this to work either:

  sharp(file)
    .toColorspace('lch')
    .toBuffer()
    .then(data => sharp(data).stats())
    .then(stats => console.log(stats))
    .catch(error => signale.error('Failed getting stats. ' + error.message));

This returns the same stats, whether I convert to 'srgb', or 'lch', or 'lab'. Am I not understanding the stats function correctly? I thought it would give me the stats for the L, C, H channels, which would be different than stats for R, G, B channels.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

No known route from 'cmyk' to 'srgb' when processing images
I am having an issue with some data returned from an external API to my GatsbyJS/ReactJS site. More specifically, the issue appears to...
Read more >
GIMP/CMYK support - ArchWiki
This article will show how to enable rudimentary CMYK support in Gimp using the Separate and Separate+ plug-ins, and explain how to use...
Read more >
Force Color Images to CMYK with a 240% Ink Limit
So a 240% TAC means there shouldn't be any place on your page that has more than 240% total ink—which can happen pretty...
Read more >
How to Convert RGB to CMYK in Photoshop and InDesign
This guide will explain the best way to convert RGB to CMYK in Photoshop and InDesign so you have more control over your...
Read more >
10 Pre-Press Tips For Perfect Print Publishing
A lot of designers think CMYK is the way to go when designing for print. We will, of course, always use CMYK-based ink,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found