Page MenuHomePhabricator

vips not rendering 16-bit greyscale tiffs properly to png
Closed, ResolvedPublic

Description

Related Objects

Event Timeline

Bawolff raised the priority of this task from to Needs Triage.
Bawolff updated the task description. (Show Details)
Bawolff subscribed.

Its probably related to the tiff being 16bit. Probably there is a bug in converting that to 8 bit png. Probably could be fixed by adding an explicit conversion step.

Also appears to be somewhat of a regression. Bug is not apparent on vips-7.38.5. At least locally.

vips im_clip2fmt in.v out.png 2

seems to fix issue.

Also appears to be somewhat of a regression. Bug is not apparent on vips-7.38.5. At least locally.

I wasn't testing locally properly. It is reproducible locally.

Change 249676 had a related patch set uploaded (by Brian Wolff):
Make vips reset bit-depth after convolution. (Fix 16 bit tiff)

https://gerrit.wikimedia.org/r/249676

Bawolff renamed this task from vips not rendering some tiffs properly to png to vips not rendering 16-bit greyscale tiffs properly to png.Oct 29 2015, 4:59 AM

Change 249676 merged by jenkins-bot:
Make vips reset bit-depth after convolution. (Fix 16 bit tiff)

https://gerrit.wikimedia.org/r/249676

Bawolff claimed this task.

These images should be fixed starting on Wednesday (Thursday for wikipedia).

MediaWiki caches images. Thus for older images you might not see the fix until someone purges them (Adds ?action=purge to the end of the url of the image description page).

jcupitt responded upstream, and says another work around is to use integer convolution instead. e.g.

vips conv shrunk.v x.png sharpen_int.mat

with the matrix being:
5 5 131 0
0 0 -1 0 0
0 -5 -11 -5 0
-1 -11 199 -11 -1
0 -5 -11 -5 0
0 0 -1 0 0

Just as a point of interest, the only thing left in https://commons.wikimedia.org/wiki/Category:TIFF_files_affected_by_MediaWiki_restrictions that legitimately should be in there (afaik) is