root
root copied to clipboard
TASImage::FromPad fails in batch mode if combined with Flip
- [x] Checked for duplicates
Describe the bug
TASImage::FromPad + TASImage::Flip does not work in batch mode, no matter the rotation angle.
Expected behavior
It should work also in batch mode.
To Reproduce
Run the code in batch mode below to get a black output. Comment the line Flip(0)
and you'll get the correct output.
void test()
{
TCanvas *c1 = new TCanvas("c1","c1",600,600);
TH1F *h = new TH1F("gaus","gaus", 100, -5, 5);
h->FillRandom("gaus", 10000);
h->Draw();
c1->Update();
TCanvas *c2 = new TCanvas("c2","c1 rotated",600,600);
TASImage *img = new TASImage();
img->FromPad(c1);
img->Flip(0);
img->Mirror();
img->Draw("x");
c2->Print("c2.png");
}
Setup
------------------------------------------------------------------
| Welcome to ROOT 6.27/01 https://root.cern |
| (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Apr 25 2022, 22:21:18 |
| From heads/master@v6-25-01-3897-gf39eb0e984 |
| With c++ (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0 |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
Additional context
https://root-forum.cern.ch/t/bug-of-tasimage-when-use-tasimage-flip/50827/ https://root-forum.cern.ch/t/timage-rendered-in-black-in-batch-not-in-interactive-mode/16781
As I said on the forum img2pad.C
is ok. Have you tried it?
Good point. So maybe the issue is rather in the function "FromPad" rather than in the function "Flip", because the following works:
TASImage *img = new TASImage("$ROOTSYS/tutorials/image/rose512.jpg");
img->Flip(0);
whereas the following only works in interactive mode:
TASImage *img = new TASImage();
img->FromPad(c1);
img->Flip(0);
TASImage is some external code. It is kind of frozen these days. This issue will be hard to fix. Is it a blocker for you?
Hi, thanks, I think this question should be asked to the original user (quzn) that reported the problem: https://root-forum.cern.ch/t/bug-of-tasimage-when-use-tasimage-flip/50827
Thanks, I left a comment in the forum post.