Create PNG Image from raw png data
-
- Posts: 3
- Joined: Mon Apr 19, 2010 2:20 pm
Create PNG Image from raw png data
Is it possible to create PNG image from raw png bytes data?
-
- Posts: 3
- Joined: Mon Apr 19, 2010 2:20 pm
I dont mind whether it is PNG or JPEG. Please check this out http://www.andrewewhite.net/wordpress/2 ... er-in-c-c/
If somebody can read the data from memory buffer and create the Image it will be great.
If somebody can read the data from memory buffer and create the Image it will be great.
I think Hybrid was hmming at the fact that you look like a spam bot.
If you're not a spam bot, then look around a little better next time
http://irrlicht.sourceforge.net/docu/cl ... 666c8436c0
~David
If you're not a spam bot, then look around a little better next time
http://irrlicht.sourceforge.net/docu/cl ... 666c8436c0
~David
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
No, I was just wondering why it is so difficult to create a PNG image from PNG bytes. For me this sounds like just dumping the bytes into a file. Now it looks as if the pixel data (ARGB or so) should be written to a PNG file or whatever format. That's the job of the IImageWriter classes, so just use those. Code can be found in the examples/Demo.
To be a bit more precise one way to go:
Code: Select all
IImage* img = driver->createImage(ECF_A8R8G8B8, dimension2du(width, height);
memcpy(img->lock(), data, sizeofdata);
img->unlock();
driver->writeImageToFile(img, "dummy.png");
won't work! bc this doesn't expect png format.Nox wrote:To be a bit more precise one way to go:Code: Select all
IImage* img = driver->createImage(ECF_A8R8G8B8, dimension2du(width, height); memcpy(img->lock(), data, sizeofdata); img->unlock(); driver->writeImageToFile(img, "dummy.png");
you will have to create a memory read file and pass that to the image loader function. but right now i am to lazy to look up the code.
EDIT: ok..well
Code: Select all
//name the file something *.png so the irrlicht loader knows its a png
IReadFile* file = filesystem->createMemoryReadFile(YourMemory, Length, "something.png", false);
IImage* myImage = videoDriver->createImageFromFile(file);
//then add a texture
videoDriver->addTexture("myNewPngTexture.png", myImage);
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.