This doesn’t work because if I write the two images in two files, the first file contains img but the second one is not created because I receive the error “No image loaded”. I know that this would work if I do img->FromPad(), but I need to avoid to do this because I would need to copy the img only knowing the pointer and not drawing it again.
In attachment there is an example of such a behaviour.
Can you tell if there are other ways to do it?
Thank you. pad2pngCopy.C (544 Bytes)
This is a problem with the copy constructor when using the base class TImage.
In reality TImage::create is a factory creating a TASImage. You can simplify your example in doing as shown below.
Rene
[code]void pad2pngCopy() {
TCanvas *c = new TCanvas;
TH1F *h = new TH1F(“gaus”, “gaus”, 100, -5, 5);
h->FillRandom(“gaus”, 10000);
h->Draw();
Hello,
probably there has been a misunderstanding. I put those lines of code to explain what I would like to do but, of course, I knew that they couldn’t work (illegal C++).
Following your advice, how can I get a pointer to the imgCopy instead of the raw one?
Thank you
Cheers,
Adriana