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

Error: Unsupported output format v #1813

Closed
MrNghia123 opened this issue Jul 29, 2019 · 10 comments
Closed

Error: Unsupported output format v #1813

MrNghia123 opened this issue Jul 29, 2019 · 10 comments
Milestone

Comments

@MrNghia123
Copy link

What is the output of running npx envinfo --binaries --languages --system --utilities?
System:
OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (1) x64 Intel Xeon Processor (Skylake, IBRS)
Memory: 456.90 MB / 1.90 GB
Container: Yes
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Utilities:
Git: 2.17.1 - /usr/bin/git
Languages:
Bash: 4.4.20 - /bin/bash
Perl: 5.26.1 - /usr/bin/perl
What are the steps to reproduce?

sharp('input.png').toFile('output.v')
throw error (Error: Unsupported output format v)

Output of console.log(sharp.versions)
{ cairo: '1.16.0',
croco: '0.6.12',
exif: '0.6.21',
expat: '2.2.6',
ffi: '3.2.1',
fontconfig: '2.13.1',
freetype: '2.10.0',
fribidi: '1.0.5',
gdkpixbuf: '2.36.12',
gettext: '0.19.8.1',
gif: '5.1.4',
glib: '2.56.4',
gsf: '1.14.45',
harfbuzz: '2.3.1',
jpeg: '2.0.2',
lcms: '2.9',
orc: '0.4.28',
pango: '1.42.4',
pixman: '0.38.0',
png: '1.6.34',
svg: '2.45.5',
tiff: '4.0.10',
uuid: '2.33.1',
vips: '8.7.4',
webp: '1.0.2',
xml: '2.9.9',
zlib: '1.2.11' }

@lovell
Copy link
Owner

lovell commented Jul 29, 2019

Hi, I can't reproduce this using the latest v0.22.1. Are you able to create a repo with code and an input image that consistently fails in this manner?

@MrNghia123
Copy link
Author

Hi,
I traced it down and the problem is actually further down the line. It seems if I pipe a V file input through Rotate then the process dies with following messages

[Error: Unsupported output format v]

(sharp:17573): GLib-CRITICAL **: 16:14:34.725: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(sharp:17573): GLib-CRITICAL **: 16:14:34.727: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(sharp:17573): GLib-CRITICAL **: 16:14:34.729: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(sharp:17573): GLib-CRITICAL **: 16:14:34.730: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed

(sharp:17573): GLib-CRITICAL **: 16:14:34.731: g_hash_table_lookup: assertion 'hash_table != NULL' failed

. The same pipe is ok if the input is PNG.

In the following code if I switch the input to PNG, or comment out the piping through rotation everything is fine.
The test image is at http://178.128.223.158/designs/test.png. However I believe the problem happens with any test image.

const sharp = require('sharp')

// url: "http://178.128.223.158/designs/test.png",
const input = "test.png"
const output = "test.v"
sharp(input).toFile(output).then(()=>{
var rotate = sharp().rotate(
-3, {
background: {r:0,g:0,b:0,alpha:0}
}
)
sharp(output)
.pipe(rotate)
.raw()
.toBuffer({resolveWithObject: true})
.then(({data,info})=>{
console.log(info)
})
})

@MrNghia123
Copy link
Author

Hi, I can't reproduce this using the latest v0.22.1. Are you able to create a repo with code and an input image that consistently fails in this manner?

@lovell : If you still have problem reproducing with the new code, please let me know.

@lovell
Copy link
Owner

lovell commented Aug 12, 2019

The vips format is only supported for filesystem-based input and output, not Buffers or Streams.

I did spot a bug relating to this where sharp.formats.v was always false. Commit 0778c11 corrects this to sharp.format.vips with the correct values, plus adds a couple of unit tests to shore up support for the vips format.

@lovell lovell added this to the 0.23.1 milestone Aug 22, 2019
@lovell
Copy link
Owner

lovell commented Sep 26, 2019

v0.23.1 now available with corrected values in sharp.format.vips.

@lovell lovell closed this as completed Sep 26, 2019
@MrNghia123
Copy link
Author

Hi,
The problem seems to persist in version 0.24. I manage to reproduce it with the following code:

`const sharp = require('sharp')
const designTempFile = "4d06e56d4a5c13bce39018f80da606b1.v"
const processDesign = async () => {
const pipeline = sharp(designTempFile)
var design = pipeline.clone()
.resize(Math.round(100),Math.round(200),{
fit:'contain',
position: 'top',
background: {r:0,g:0,b:0,alpha:0}
})
var rotate = sharp().rotate(
45, {
background: {r:0,g:0,b:0,alpha:0}
}
)
design = design.pipe(rotate)
const {data: designBuff, info} = await design.raw().toBuffer({resolveWithObject: true})
console.log(info)
}

processDesign()`

4d06e56d4a5c13bce39018f80da606b1.v.zip

@MrNghia123
Copy link
Author

@lovell : I am pretty sure this is a bug with the rotation function. Should I open another issue or we can track it with this one?
Regards

@MrNghia123
Copy link
Author

The error seems to happen only when rotation is last in the pipeline before output to buffer. If I switch the order of resize and rotation in the above example then there is no exception.
For png inputs it works regardless of the sequence.

@lovell
Copy link
Owner

lovell commented Feb 10, 2020

The vips format is only supported for filesystem-based input and output, not Buffers or Streams.

The use of design.pipe(rotate) implies Stream-based intermediate output.

@MrNghia123
Copy link
Author

Thank you @lovell for such a great library and so quick support.

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

2 participants