Mattermost-server: Do not convert PNG to JPEG when generating preview

Created on 17 Oct 2017  路  10Comments  路  Source: mattermost/mattermost-server

Summary

Do not convert uploaded PNG to JPEG.

Screenshots and other files look really bad after conversion. Since we are running our own server we have plenty of space for all the PNGs our team can generate in a lifetime.

Seemingly Mattermost is using this site to convert the files:

image

http://needsmorejpeg.com/

Steps to reproduce

Upload a PNG file from clipboard or as a file.

Expected behavior

Keep PNG on disk, do not convert.

Observed behavior (that appears unintentional)

Low quality JPG with compression artifacts

Most helpful comment

or make it an option if we don鈥檛 want to change the current behaviour

All 10 comments

or make it an option if we don鈥檛 want to change the current behaviour

Hi @towolf and @hloeffler

Thanks for your feedback!

Perhaps I'm not understanding your issue correctly but if I upload a .png file on our nightly build server running v4.3 it posts as a .png. Even if I download it, it still remains a .png.

Can you share which version of Mattermost you're running as well as whether you're using the browser or desktop app? If browser, which one?

When I download it I get the PNG back too.

But the preview popup is a overly compressed JPG. And for clean screenshots this looks not so good.

image

Note that here, for example, GitHub does not do that. They keep PNG as PNG even when downsizing.

Amended title.

Thanks for the additional feedback @towolf

I'll ask our UI designer to take a look at your issue and leave feedback here for you :)

@towolf I understand, and this seems like a valid concern, I'll queue this for discussion. We can also think about adding a conditional to check and convert only if the file is quite large instead of providing an option. As with the current behaviour, I suppose even quite small images get pixelated.

@towolf Also, I just checked, I guess we do convert them into jpgs for the thumbnails, but for the previews, I still get a png format.
And I'm not talking after a download, just talking about even if I download the image that's shown by inspecting element.

Yeah, that is even worse.

It has a .png filename extension, but it contains JPEG:

 $ file Image+Pasted+at+2017-10-17+15-50.png 
Image+Pasted+at+2017-10-17+15-50.png: JPEG image data, baseline, precision 8, 621x428, frames 3

We've decided to keep pngs pngs. Even if we reduce the size.

We can track this issue via the Jira ticket so I will close it off here for now.

Was this page helpful?
0 / 5 - 0 ratings