@Skidracer: SavePixmapPNG with 256 colors only?
BlitzMax Forums/BlitzMax Beginners Area/@Skidracer: SavePixmapPNG with 256 colors only?
| ||
Hello! Is there a flag for SavePixmapPNG so that it only uses 256 colors or grayscale? 16M really boosts the filesize on larger images (even with compression level 9)! If not, could you add this for the next update please? Grisu |
| ||
Try: px=ConvertPixmap(px2,PF_I8) SavePixmapPNG(px, .... etc This will convert the pixmap into grayscale, probably based on one of the components, not sure how it works really, but it should then only save a 256-color image. I have used it to draw a grayscale image and then save it only as 1 channel. |
| ||
Grayscale works, thanks Angel! 256 color would awesome... |
| ||
I don't think Max will be supporting 256-color stuff anytime soon. It is quite an old display system, the kind of thing you had 10 years ago, or more. I know some games are cool with it, and it is nice and fast using old-school techniques. But these days you can almost assume everyone will be using at least a 16-bit true-color non-paletted mode. Also some OpenGL implementations don't support indexed mode. You would probably have to do all your own code if you want to support 256-color indexed graphics. Your image doesn't have to be grayscale, you just need to work with whatever way the pixmaps are working. You could draw everything into the Red channel and download it with glReadPixels() to a GL_RED based memory buffer. I don't think you're likely to see 256-color support added to blitz anytime soon. |
| ||
AD: This isn't about true indexed display modes, it's just about saving PNG files that aren't unnecessarily huge by quantizing the color down to a limited palette. Indexed PNG images are still loaded into full RGB colour pixmaps. I think this would be a good addition too, probably an extra optional parameter in SavePixmapPNG to activate it would be the best idea. I don't know how hard it is to do a good colour-quantization procedure though, hopefully there's a freely useable one somewhere. |
| ||
256-color is old for displaying, but still very useful in files. In my case for mobile devices. |
| ||
>>>256-color is old for displaying is this a joke? most people use 256 colors for smaler file sizes... |
| ||
An example: My iconstrip saved as 16M PNG wastes 2,5 MB. With 256 colors it is 560 KB small! And this is a lot! Yes, I could use Jpg for compression once we have SavePixmapJPG, but the image will look blurry then! |
| ||
MrCredo - maybe you should actually read my whole post. :) |
| ||
Ahhh now I get what you're after. Yes, you'd need to have the colors quantized down and then saved as a proper 256-color PNG. That could be a nice addition, especially to balance out the loading of PNG's at various depths. I agree that for some purposes, like icons and gui's and stuff like that, 256-colors is sufficient. After all, lots of 256-color games have been popular and since you are converting from 256 to 24-bit, you have more than just one palette, so no real limits on the number of colors (other than that each file can only have 256). I hear they are going to also include SavePixmapJPG in the next update. :-) It would be nice to also have Load and save of GIF which I believe now is patent free? and BMP? and jpeg2000? and maybe TIFF? |
| ||
Skidracer gets a heart attack if he reads all the requests here... ;) *puts his life rescue kit in a place nearby* |
| ||
hm.. i don't know how to create a pixmap with 256 colors and set the palette colors? is this possible in blitz? |
| ||
It's not currently supported. Max pretty much assumes in most places that you'll have a 16 or 32 bit display. It doesn't have any pallete options, other than some that are provided by OpenGL. |
| ||
Bmx supports 256 grayscale. So it shouldn't be hard making it 256 colors. |
| ||
hm... i think blitzmax should have full 256-color-support for pixmaps (for creating and saving images) - but opengl/dx-output with 256 colors is not up-to-date - and is not needed. |
| ||
I never asked for a 256 color display mode! Someone misunderstood that. |
| ||
yes and i do not mean your posting - only a idea for blitz-creators... |
| ||
How to output a 256 color image if your image within BM is not paletted? Using autopaletting isn't a solution, the output would be useless in most cass. You would need to provide a palette and manually write the pixmap data according to that palette. That way, sure it would be smaller for saving. But much of work just for a few kb ... especially if the output result would look definitely better if using a true graphic program. |
| ||
Dreamora - we should be able to define palettes and pixmap data manually - but at the moment we can only set pixmap data and not palette data - that's all BlitzMax should do not more... at this way - we can create a program that can create optimized images for web. And 256 color is useful for web graphics... At the moment - i think i can't do it (without extern lib or so) |
| ||
At the moment, you would need to implement the rest of the png libs functionality, at least if the open lib supports paletted PNGs. |
| ||
If you really MUST have 256 color PALETTE mode support, PureBasic still supports it... :) Also, I hear jpeg2000 does a good job with quality and small file sizes. Don't know if there's a loader/saver for BM, yet. Russell |
| ||
Did we ever get 256 png saves? |
| ||
I can recommend pngquant. |