Remove legend from falsecolor

Hi all,
I’m trying to remove the legend from the falsecolor output with the following command (Radiance Windows):

5.2 --> perl C:\Radiance\bin\falsecolor.pl -ip current_test_ill.hdr -s 1000 -n 10 -lw 0 -pal spec > current_test_false.hdr

5.3 --> falsecolor -ip current_test_ill.hdr -s 1000 -n 10 -lw 0 -pal spec > current_test_false.hdr

The program stops because it doesn’t found slab.hdr and scol.hdr in the Windows Temp folder.
If I omit the -lw flag it works just fine.

What I’m doing wrong?

Are you using the latest release? How was it installed? Can someone else test this out, maybe @Axel_Jacobs1 ? I don’t have a Windows machine to install it on.

Yes, I’m using the latest release. I tried to install it both from the zip file and from the executable… same result. Also bringing back the 5.2’s falsecolor.pl presents the same problem.

This is the exact error:
C:\Users\Mattia\AppData\Local\Temp\JfOVVgXpz1/slab.hdr: bad picture size
C:\Users\Mattia\AppData\Local\Temp\JfOVVgXpz1/scol.hdr: bad picture size
write error: Invalid argument

I see that the last slash is a forward one, maybe Windows doesn’t like it?

I tried replicating this, but couldn’t. Running falsecolor.exe with the given command line (both, with and without -lw) works fine on my machine.

You seem to have a Perl interpreter installed. Could you please replace line 107 of falsecolor.pl (edit a copy in your pwd) with the following:

---------------- 8< -----------------
my $td = tempdir( CLEANUP => 0 );
my $tdtxt = “td.txt”;
open(FHtdtxt, “>$tdtxt”) or
die(“Unable to write to file $tdtxt\n”);
print FHtdtxt “tempdir: $td”;
close FHtdtxt;
---------------- 8< -----------------

This will create td.txt in the same directory with only one line in it – the location of the temp folder under AppData\Local\Temp

What kind of files do you find in there (dir /L)? Do you get slab.hdr and scol.hdr?

Start off with the very latest release from https://github.com/LBNL-ETA/Radiance/releases, which is currently Radiance 5.4a (2020-09-06). You need the Source Code (zip)

Sorry I did’t reply sooner.

Yes, I have ActiveState Perl installed (I think is the interpreter you were referring to).
Here is the content of the Temp folder:

PS You said “Running falsecolor.exe with the given command line (both, with and without -lw) works fine on my machine”. Actually I’m having problems if I use -lw 0, If I omit the flag or I give it a non-zero value it works for me too.

Hi Mattia, I still can’t replicate the error you are seeing with -lw 0. Works fine for me. In the screenshot you posted, are slab.hdr and scol.hdr valid HDR images that you can open with your HDR viewer?

slab.hdr and scol.hdr are not valid hdr files that I can open (I used https://viewer.openhdr.org/ to check).

I also tried to use it on a different pc using the Radiance Tutorial example files (The room_nice example) to be sure that my input files weren’t corrupted, and the same error comes up.

I also noticed that the error occurs if I set -lw from 0 to 20 included, and it stops when I set a value greater than 21.

That seems odd. Can you post one of these illegal HDR files, maybe gzip’ping it first to make sure it doesn’t get corrupted along the way?

Here are the scol and slab files:

These files are indeed messed up. They are 1x1 (single pixel) images with CR-LF sequences that should be just linefeeds. I am not sure how they are being created. Are you sure you are using the latest version of psign, and not some problematic version? Unfortunately, I can’t really debug your problem from here, unless someone else can help you reproduce it.

I tried multiple radiance windows versions’ precompiled binaries, and the same error occurs.
At this point, I think it’s something related to my system, not the software.

Meanwhile, I’ll just remove the legend with ImageMagick when I need to.

Thanks anyway for the great support. I’ll let you know if I understand what’s wrong.

Are you using the Windows Powershell by any chance? If so, can you try it using cmd, instead?

Nope, already using cmd :wink:

Hi @Greg_Ward, I could recreate the error on my machine. From what I can see in the source code when -lw is less than 20 it is set to 0 to ignore the legend:

Which then means that it tries to create a dummy color scale from some two images that it expects to be in the temp folder. scolpic and slabpic - which it fails to find and that’s why it raises the issue:

When I run the command with a larger value for -lw I can see that the temp folder with all the temp files are created. I can also see all the images being created by running the falsecolor command with no argument while it is waiting for the stdin to provide an input.

PS: I think between the time that the images are created and when you try to read them the temp folder is being deleted so the command cannot find the files when it looks for them.

1 Like

Wow – didn’t think to look at that! This makes perfect sense, as the code works under Unix, but the linefeeds get changed to CR-LF sequences under Windows.

I checked in a hopefully fixed version just now – you can download it directly here or wait for it to percolate to the installers this weekend.

Axel Jacobs wrote this script, so I can use that as an excuse for not finding this, myself. Thanks, @Mostapha !

2 Likes

Thanks, it’s working now.

1 Like