Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

media/thumbnailer: Better quality for 1-bit / 8-bit color palette images #2142

Merged
merged 4 commits into from
Oct 4, 2019

Conversation

superdump
Copy link
Contributor

Pillow will use nearest neighbour as the resampling algorithm if the
source image is either 1-bit or a color palette using 8 bits. If we
convert to RGB before scaling, we'll probably get a better result.

Note: I haven't actually tested this but setting up a synapse just to do so is more effort than I'm willing at this particular moment.

Pillow will use nearest neighbour as the resampling algorithm if the
source image is either 1-bit or a color palette using 8 bits. If we
convert to RGB before scaling, we'll probably get a better result.
@superdump superdump requested a review from NegativeMjark April 20, 2017 19:45
@ara4n
Copy link
Member

ara4n commented Apr 20, 2017

lgtm, but please do test it first. setting up a synapse on OSX is absolutely trivial and very worthwhile - in your git checkout, just:

# deps, if needed
sudo easy_install pip
sudo pip install virtualenv
brew install pkg-config libffi

virtualenv -p python2.7 env
source env/bin/activate
pip install --upgrade pip
pip install --upgrade setuptools
python synapse/python_dependencies.py | xargs pip install
pip install lxml mock

# gen the config
python -m synapse.app.homeserver \
    --server-name my.domain.name \
    --config-path homeserver.yaml \
    --generate-config \
    --report-stats=yes

# start the synapse
./synctl start

i'd be surprised if copy-pasting that didn't give you a working homeserver on port 8008 ready to test against.

Copy link
Contributor

@NegativeMjark NegativeMjark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but it might be nice to test uploading a 1-bit image with a unit test or a sytest. (I'm happy to take you at your word wrt image quality, but it would be nice to have some way to check it doesn't crash)

@APwhitehat
Copy link
Contributor

I tried uploading 1-bit & 8-bit image via riot-web and synapse showed no errors.
I used this and this .

Tell me if more rigorous test is required.

@richvdh
Copy link
Member

richvdh commented Oct 3, 2019

I don't know why we never merged this

@richvdh richvdh merged commit 39b40d6 into develop Oct 4, 2019
@richvdh richvdh deleted the rob/thumbnail-quality branch October 4, 2019 08:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants