Skip to content

Problem with resizing rgb16 png images when embed() function is used #325

@janaz

Description

@janaz

Sharp 0.12.1 is incorrectly resizing the following PNG image when embed() function is used and the output image has different aspect ratio than the original image.

It seems that only rgb16 png images are affected by this issue.

I'm using vips 8.1.1 with libpng 1.5.13.

the original image

Metadata: format=png, width=600, height=600, space=rgb16, channels=4, hasProfile=false, hasAlpha=true

##### the result of img.embed().resize(200, 201)

##### the result of img.embed().resize(200, 200)

##### the result of img.resize(200, 201)

##### Steps to reproduce: 1. Download the source image
curl -O http://i.imgur.com/9Y6MLBf.png
  1. Execute the following Node.js script

    var sharp = require('sharp');
    
    var img = sharp('9Y6MLBf.png');
    img.embed().resize(200,201).toFile('resized-200x201-embed.png');
    
    img = sharp('9Y6MLBf.png');
    img.resize(200,201).toFile('resized-200x201-noembed.png');
    
    img = sharp('9Y6MLBf.png');
    img.embed().resize(200,200).toFile('resized-200x200-embed.png');

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions