Bug of TASImage when use TASImage::Flip()

Hi! I tried to use TSAImage::Flip() to rotate a figure but it failed to save a right figure by Print() when I use batch mode. How to solve it?

test.C (460 Bytes)

@couet Actually, it’s also broken in “interactive mode”. It seems to me that it uses improper pad sizes. I get a good picture if I resize the canvas with a mouse.

Thank you for your reply. It it true that the first picture has an improper size in interactive mode and resize the canvas can solve this problem. But my problem is that the second picture shows a completely black pad instead of a rotated picure in batch mode. I need to use batch mode because I have a dozen figures to draw and adjusting them in interactive mode with a mouse one by one is not realistic.

https://root-forum.cern.ch/t/timage-rendered-in-black-in-batch-not-in-interactive-mode/16781?u=quzn

I find a similar problem which was raised in 2013. So root keeps this bug for about 10 years?

I also saw one issue with batch mode and divided canvases some time ago: [ROOT-7969] SaveAs png fails in batch mode with two canvases, one divided - SFTJIRA It was fixed last year. Maybe it’s an analogous problem.

I have filed: TASImage::Flip fails in batch mode · Issue #10996 · root-project/root · GitHub

I tried SaveAs() function, pdf format, and undivided canvas. None of them works so I don’t think this is an analogous problem. Maybe the key point is the description of the Flip():

the original pixel values would be destroyed
because the function with similar description Mirror() also shows the problem as I described above.

The ROOT tutorial illustrating the Flip and Mirror commands is img2pad.C. Seems to me it is working fine.
(sorry for the delay in replying I was off last week).

The problem might be with the function TASImage::FromPad, that has a different implementation in batch mode, rather than with the function TASImage::Flip itself.

You are right. I tried to open a figure by TASImage::Open() directly and fliped it successfully. But when I drew a new histogram in a new canvas, created a new image by TASImage::FromPad() from this canvas and fliped it, the problem came up.

Very thanks, this example gives me another way to draw my picture. However, the problem still exists when I get the image with the function TASImage::FromPad directly from a canvas I have defined above and flip it.

If the TASImage::FromPad is broken, then probably also in “interactive mode”.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

TASImage is some external code. It is kind of frozen these days. We have no fix in mind for the time being and it is not a priority. Is it a blocker for you?