I have a canvas and I would like to have a jpg/gif/png image of its content and save it in a database. I see that I can use SaveAs to save an image corresponding to a canvas into a file.
How can I do the same, but not create a file simply get a pointer to the actual image data ?
Something that can be saved in a database and retrieved by a non-ROOT process and displayed (for example PHP) ?
I went through the tutorials, but I don’t think any of them answer my question.
I will try to rephrase my problem :
I have a TObject. If I would Draw() this TObject on a Canvas and then SaveAs(“xxx.png”) this Canvas, I would get a file containing a PNG image. Right ?
Now, all I want is the content of the file to be saved in a database. However, I don’t want to display anything (there is no gui) nor to save locally a file.
delete h;
delete c;
delete img;
}[/code]
Just don’t write the image to file… Then you can access the image buffer (see TImage doc: http://root.cern.ch/root/html/TImage.html)
I saw this tutorial and thought that I couldn’t access the image buffer directly. Although I read the documentation of TImage, I missed the GetImageBuffer method…
Sorry, about that and a big thank to all for your help.
No plans to add a TCanvas-less TPad, this would just add confusion and it is not required. See previous mails above to get access to the image pixels info.
[quote=“brun”]No plans to add a TCanvas-less TPad,[/quote]It is already exists. [quote=“brun”]this would just add confusion and it is not required.[/quote]One doesn’t need to create any separate class. It is enough to add some option to TPad ctor indeed. If such flag would be there one might not have introduced the TEmbeddedPad at all to satisfy some users’ needs. I had no idea how to do what I needed via TCanvas/TPad combination.[quote=“brun”]See previous mails above to get access to the image pixels info.[/quote]It is not a main question. The main question is, “How to create TPad image off-screen within the interactive ROOT session?” The TEmbeddedPad class is to address very this issue.[quote=“Barth”]I am wondering why TEmbeddedPad is in QtRoot and not directly in ROOT ? [/quote]3 years ago root.cern.ch/phpBB2/viewtopic.php?t=3185 I was wondering too. TEmbeddedPad has no Qt package dependency. I had no time to argue though. It was faster and simpler to write that class meantime and move on