Chlumsky / msdfgen

Multi-channel signed distance field generator
MIT License
3.97k stars 412 forks source link

24 bit or 8 bit #97

Closed alexeik closed 4 years ago

alexeik commented 4 years ago

hi "msdf -font freesans.ttf '" + n + "' -size 32 32 -pxrange 4 -translate 5 5 -scale 1 -o " + (int)n + ".png" render msdf textures (ong ) does some random in bit per pixels. It varies: image

can it be adjusted?

Chlumsky commented 4 years ago

Where did you get this information about "bit per pixels"? The PNG files are compressed by LodePNG, so maybe direct your issue there. Also, why is this even a problem? If it bothers you, maybe re-encode the images using a third-party program.

alexeik commented 4 years ago

i cant load this png into openGL because of 8-bit. and irfanview shows 8bit and i did re-encode in irfanview but nice not to have 3rd party to make this thing

Chlumsky commented 4 years ago

There is no reason you wouldn't be able to load it into openGL because of 8-bit. This issue is nonsense. If you believe it's not, post to LodePNG and see what they tell you.

alexeik commented 4 years ago

oh i need 24bit png for openGL, but it pushes mixed pngs.

Chlumsky commented 4 years ago

No, you don't. OpenGL doesn't even load PNG at all, you have no idea what you're talking about.

alexeik commented 4 years ago

its about format for opengl texture. it setted to rgba16 but then itloads 8bit png it gets breaked. it took some time to understand why one letters good and other is bad. and then i found that bug in your program. and u must understand it all about stride. ok?

Chlumsky commented 4 years ago

This is not a bug in my program. PNG encoding in my program is facilitated by the LodePNG library. It is not a bug in LodePNG either, it is intended behavior - the library (presumably) picks either 8-bit or 24-bit PNG format depending on which is better for compression for the particular input. Both are equally valid PNG files and both encode the bitmap losslessly. There is no practical difference. The actual bug is in your code, where the PNG file is decoded. This has nothing to do with OpenGL, textures, or stride.

Please don't accuse other people of bugs if you have absolutely no idea what you're doing and go to Stack Overflow or somewhere else, this is not a Q&A forum.

alexeik commented 4 years ago

its ok. but just my PNG loader setted to load 24bit. and i dont expect that there are will be 8bit.

alexeik commented 4 years ago

and why u dont like to answer ? it sok here. we eeven can chat here. u looks not freindly, why?

Chlumsky commented 4 years ago

Because I already answered and explained multiple times that this is not a bug on my part and you keep saying that it is. It is frustrating because you clearly don't understand the topic.

I don't mind helping people with fixing their code but this is not the right place for that. A GitHub issue isn't a chat room.

alexeik commented 4 years ago

i have tested last commit its still produces 8bits file for 0 and O chars

Chlumsky commented 4 years ago

Did you read anything I wrote? Yes, it produces 8-bit files and it will continue to do so, because it is not a bug. There is nothing wrong with 8-bit PNG files, there is no reason to change this, fix your loader to expect all valid PNG files.

programmerjake commented 4 years ago

@alexeik You can use ImageMagick's convert program to convert between PNG formats if you want your PNGs in a particular format. I haven't tested it, but this command will probably do what you want:

convert -depth 24 input_file.png output_file.png