Graphics saved upside-down
achho opened this issue · 8 comments
Hi all,
since commit "Small changes in a number of files." (af66b7c), graphics are saved upside down when using this code:
data = cgDemoData(2)
LoadCT, 33, NCOLORS=12, BOTTOM=1
cgContour, data, NLEVELS=12, C_COLORS=Indgen(12)+1, /FILL, /WINDOW
cgControl, CREATE_PNG='some file'
I had come across a similar problem earlier in a different context. There, the issue was related to the !ORDER system variable. In this case, changing it, doesn't seem to make a difference.
Thanks for the support!
Cheers, Achim
IDL's PostScript output (used to create the PNG file in this case) has always been "upside down" or seascape, rather than landscape. Coyote Graphics fixes this problem by actually opening the PostScript file and rewriting some of the PostScript code. (See cgFixPS). So, if your output is upside down, I can think of two possible reasons. One, you don't have cgFixPS in your IDL path, so the file can't be fixed. Or, two, the folks who create IDL have fixed this egregious error in the PostScript driver since I retired. I think the latter is probably highly unlikely, so I suspect the first reason is more likely.
Hi,
thanks for the quick response. However, I don't think the problem is related with the cgFixPS path because the error only occurs when using the above-mentioned commit (af66b7c) or a later one. When switching to an older version of the library, everything works fine.
Cheers, Achim
Hi again,
in the above-mentioned commit, cgFixPS was changed. A check has been added, to ensure that file size is not 0 (lines 187-193). However, the check is done using a fresh, unused LUN retrieved with Get_Lun, in_lun
. The file size of that LUN must always be 0. Therefore, the procedure returns without action.
From what I understand, shouldn't the check be done after opening the file and using the respective LUN?
Cheers, Achim
I have also had this same issue. I think that instead of using IF (FStat(in_lun)).size EQ 0 THEN BEGIN the statement could be "IF (File_Info(in_filename)).size EQ 0 THEN BEGIN". (Unless of course there is a problem with File_Info on another platform. I have only tested with RedHat Linux.)
And to be sure, I didn't test this. Sorry. I'm not using IDL much anywhere anymore.
Thanks @flamingbear, PR #9 fixes the bug just fine!
Thanks.