# Very small PNGs are inappropriately converted to JPGs

**URL:** https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365
**Category:** Bug
**Created:** [11월 20, 2018, 5:14오전 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365 "2018-11-20T05:14:23Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11월 20, 2018, 5:14오전 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/1 "2018-11-20T05:14:23Z")

</div>

It appears that transparent logos are no longer possible…this has broken our logo on [our site](https://forums.librehealth.io).

This is a transparent background with white text – uploaded one to imgur so I could show what it is supposed to be. It seems to be getting converted to JPEG

[actual logo](https://i.imgur.com/bihQIec.png) vs Uploaded below – note it’s a white-background so just right-click and save to see the bug:

 ![1ae6a9e6a1a1f0b8654292cc7f1eb962af1278cf](https://global.discourse-cdn.com/meta/original/3X/9/2/92e2744b4fcb53ce32c32fe8986305a85652a508.jpeg)

Is there any way to preserve transparent backgrounds and not make them white – which makes the text..and everything go away…

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [11월 20, 2018, 5:30오전 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/2 "2018-11-20T05:30:59Z")

</div>

The Imgur file is a PNG, the upload is a jpg, jpegs don’t support transparency.

Are you saying Discourse converted your PNG logo into JPG?

Was this a logo uploaded to the ‘Assets for the Site Design’ thread, or using the new site logo interface?

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11월 20, 2018, 9:54오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/3 "2018-11-20T21:54:42Z")

</div>

The new site logo interface-- How would I force it to use the Assets for the Site Design thread one?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 20, 2018, 9:59오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/4 "2018-11-20T21:59:51Z")

</div>

Have we reproduced this @tgxworld?

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11월 20, 2018, 10:34오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/5 "2018-11-20T22:34:43Z")

</div>

If I upload a PNG, I’d like it to remain a PNG personally…and @codinghorror – I did actually reproduce it – see my original post 🙂 – it is convertng to JPEG all images apparently

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 20, 2018, 10:35오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/6 "2018-11-20T22:35:48Z")

</div>

This usually implies the file is not optimized, and therefore far larger than it should be. Have you tried running the PNG through a lossless optimizer first?

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [11월 20, 2018, 10:38오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/7 "2018-11-20T22:38:21Z")

</div>

Isn’t it the option `png to jpg quality` that automatically compress png files?

You should try by putting `100` in this setting

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11월 20, 2018, 10:38오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/8 "2018-11-20T22:38:48Z")

</div>

> [@codinghorror](#):
>
> This usually implies the file is not optimized, and therefore far larger than it should be. Have you tried running the PNG through a lossless optimizer first?

I just grabbed it from the Assets for Site Design thread and uploaded it. I could do that and try again… could we just optimize the PNGs and not convert to JPEG so that we could preserve transparency?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 20, 2018, 10:39오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/9 "2018-11-20T22:39:55Z")

</div>

I’m on vacation so it’s hard for me to test things at this time, but I strongly suspect that if you ran the PNG through a lossless optimizer (google for it, if you need to), you’ll get a much smaller image that won’t be converted due to size. I could be wrong, but this is my best technical guess based on what I know at this moment.

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11월 20, 2018, 10:40오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/10 "2018-11-20T22:40:39Z")

</div>

Thiis is not time-sensitive and can wait until after the holidays 🙂

Could a solution be to optimize the PNG server-side rather than convert to JPEG be an option?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 20, 2018, 10:42오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/11 "2018-11-20T22:42:24Z")

</div>

Anyone reading this has all the information necessary to test the hypothesis.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11월 20, 2018, 10:42오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/12 "2018-11-20T22:42:58Z")

</div>

We will get this sorted, very likely due to image optimization. I am very surprised that our optimisation is stripping transparent pixels.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 20, 2018, 10:44오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/14 "2018-11-20T22:44:00Z")

</div>

It’s filesize based, for the most part. If the image is _wildly_ smaller as a jpg then that’s what we choose. Only a perversely egregious PNG would cause this to happen.

Edit: that does NOT appear to be the case (13kb PNG), so if this is happening, it is a different bug @sam

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11월 20, 2018, 10:45오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/15 "2018-11-20T22:45:47Z")

</div>

> [@codinghorror](#):
>
> It’s filesize based, for the most part. If the image is _wildly_ smaller as a jpg then that’s what we choose. Only a perversely egregious PNG would cause this to happen.

```plaintext
$ du -sh transparent_logo.png 
28K	transparent_logo.png

```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 20, 2018, 10:46오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/16 "2018-11-20T22:46:26Z")

</div>

Weird, it is 13kb from imgur so I suspect it’s not optimized.

Either way both 13kb and 26kb are plenty small, so my hypothesis was not correct.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11월 20, 2018, 10:46오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/17 "2018-11-20T22:46:41Z")

</div>

@robbyoconnor yeah something is not right … this PNG is tiny … 12.2k

 ![1ae6a9e6a1a1f0b8654292cc7f1eb962af1278cf](https://global.discourse-cdn.com/meta/original/3X/9/2/92e2744b4fcb53ce32c32fe8986305a85652a508.jpeg)

JPEG converting this should not happen… yet… it happens.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 20, 2018, 10:47오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/18 "2018-11-20T22:47:46Z")

</div>

I think it’s because the jpg is only 5kb, so that’s viewed as a significant filesize savings (by percentage perhaps). We should disable this optimization step when the total size is under, say, 100kb?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11월 20, 2018, 10:48오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/19 "2018-11-20T22:48:47Z")

</div>

On it… yeah I would say it has to have a threshold of absolute savings in bytes as well… minimum saving of say 100k.

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11월 20, 2018, 10:55오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/21 "2018-11-20T22:55:19Z")

</div>

```plaintext
$ optipng transparent_logo.png -o7
** Processing: transparent_logo.png
2400x600 pixels, 8 bits/pixel, 17 colors (16 transparent) in palette
Input IDAT size = 12340 bytes
Input file size = 12715 bytes

Trying:
  zc = 9 zm = 8 zs = 3 f = 5 IDAT size = 12340

transparent_logo.png is already optimized.

```

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [11월 20, 2018, 10:58오후 UTC](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365/22 "2018-11-20T22:58:39Z")

</div>

I completely missed the fact that it was converted to JPEG somehow

[Next page](https://meta.discourse.org/t/very-small-pngs-are-inappropriately-converted-to-jpgs/102365.md?page=2)
