Pngs saved as jpeg when posted on forum breaking transparency

link saved as png has transparency and alpha working properly



when uploaded on forums you just have white where transparency layer should be. matters to me since avatars dont work right and the jpeg work around to get transparency working seems like a lot of work. any way we could upload pngs and have them stay pngs?

also apparently after a short while the forums stops showing the embedded link and instead uploads and host a copy as a jpg which breaks transparency and maybe could be a copywrite issue? idk not a lawyer

2 Likes

AFAIK the JPEG standard does not contain a transparency specification so it cannot contain said data.

Transparency works in a way that a specific color is chosen in the hex format:
000000 (black)
FFFFFF (white)
00FF00 (green - usually picked, sometimes pink)

and all pixels with that specific color is tagged for transparency. PNG has this information and can display it correctly but the JPEG format does not support it and just shows the transparency color instead.

1 Like

PNG:
Uploaded to forum:
test_img_1

Embedded:

1 Like
Testing a couple...

grunt.PNG

Shikinami-cheer-emoticon

Seems inconsistent. First image is PNG and the forum kept it as PNG. Second image is PNG and the forum converted it to JPEG. Third is just a GIF with transparency and transparency stayed.

EDIT: Another PNG that stayed PNG and one that didn't.

DJobto8XUAAfDvE

3 Likes

wel still a problem, bump?

Looking at the difference in the images posted, my guess would be that it’s transcoding to JPG when the PNG is over a certain filesize. Looks like it’s also downscaling?

@wendell/@SgtAwesomesauce, is there a parameter for this?

3 Likes

One funny thing about that is when you have lots of solid colors, PNGs can be smaller then JPGs:
smol smol

Edit: Would help to have the file size in there…
image

1 Like

Yeah, my theory’s out the window, unless the limit is stupidly low. Tried PNGs with alpha ranging from 1024x1024 to 8192x8192 with different compression levels, and they all just got made into JPGs.

1 Like

The client side image optimization can be left enabled, as it respects transparent files. The feature you need to disable is the server side PNG to JPG conversion.


Looks like that setting will convert to jpeg only if it will be smaller than the original format, otherwise it will leave it as is. Probably why there are inconsistent results.

Steg as in “Steganography”?
Yes, that is easier with PNG since it is lossless compression.

1 Like

soooooo fix when?

well smol scaled down png zoomed out with more transparency at the edges seems to have done the trick being small enough to stay png and not get converted. figured i would post my “fix” so anyone else struggling with this would figure it out. lots of extra space full of transparency is something pngs do well so if you have enough extra space and low enough file size on the actual image it doesnt make sense to swap to jpeg so it doesnt.
big

smol

or there was a back end change and the big image will stay transparent now

Turn forum conversion off and just preserve the uploaded format? Space is cheap man and objectively at this scale so is bandwidth. I mean is it really that big of a deal. I dont think I see a bunch of people rolling around posting 50 MB gifs and PNGs at most its like 8 MB

Also your proxy still has a back end issue.

image

Your thing says thats the limit but above 10 MB it still does not upload

1 Like

i think it will have something to do with the amount of compression in the jpeg as to whether the site converts it or not.
the trade off being load times for the image.
with higher compression images, while smaller take longer to load completely on the website.

1 Like