Jump to content
  • Advertisement
Sign in to follow this  
Sik_the_hedgehog

Things I wish I had never heard

This topic is 802 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

"as a workaround you could probably decode JNG with javascript"

 

For context: https://en.wikipedia.org/wiki/JPEG_Network_Graphics

Basically JPEG for color with PNG for alpha. Legitimately good idea, but not supported in browsers because it's a subset of MNG and there's a religious war against MNG pretty much. But yeah, not the kind of thing you want to do in javascript, you'd be implementing the decompression algorithm yourself for starters...

Share this post


Link to post
Share on other sites
Advertisement

PNG compresses much worse for things like photos or the like (PNG is good at flat shades and gradients), but JPEG can't support transparencies at all so you're forced to stick with the rectangular shape. JNG is meant to be a middle point that uses the best part of both (see how its name is a mix of JPEG and PNG, even). Browsers don't support it though, so probably your best choice here is to split it into two files (a JPEG and a PNG) and merge them in a canvas. Or you can be careless, parse the format yourself in a script, then bring the browser to a halt because of how much CPU time and RAM you're hogging by doing that. Especially if the image is large.

Share this post


Link to post
Share on other sites
PNG compresses much worse for things like photos or the like

Yes, however it's my understanding that you can use any compressing technique with it if you have the programming skills; I am only a hobbyist programmer so I could be wrong.

There was a network gaming company I did some 3D work for, they had us using a "lossy PNG compressor" although honestly I prefer my textures with out grainy noise in them.

 

 

 

(a JPEG and a PNG) and merge them in a canvas

Couldn't you just use a JPG and then add a array to show the alpha, so each image when saved will be a JPG and a array that you save as a text or binary file.

 

edit:

JPG 2000, doesn't it support alpha?. Never used it as I mostly use TGA and what my client ask witch is %90 PNG.

Edited by Scouting Ninja

Share this post


Link to post
Share on other sites

Yeah, converting the PNG to 8-bit with dithering is another option (that turns out to save a lot of space), though not everybody likes the dithering and also has a serious potential to backfire if there are too many hues. Still probably the best option when you have control over what images are processed though, especially at high resolution. As for JPEG 2000, I think it also has the issue of nearly nothing supporting it, at least as far as everyday use goes (IIRC it has way more support in the professional side of things).

 

In any case the original point wasn't so much this but rather the suggestion of using javascript for an horrendously expensive operation =P

Share this post


Link to post
Share on other sites

In any case the original point wasn't so much this but rather the suggestion of using javascript for an horrendously expensive operation =P

Still I learned a lot and a believe it will help others who want to make browser games. :D  

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!