Raw image handling in Fiji/ImageJ

Hello.

I have a question regarding RAW file format issues.
This is a heigthmap image in .PNG format:

I want to export this image in RAW format, 16 or 8 bit to create a terrain in Unity.

File->Save As->Raw Data

Everything looks ok, but when I close and then open the image again in Fiji/ImageJ in the created RAW format it looks like this:

Something strange obviously happens while saving in RAW.

The corresponding heightmap in Unity looks like this which is based on the bogus RAW data file. (Not correct)

Any ideas how to retain the original heightmap data while saving to RAW?

Best regards://Kjell-Ove

Actually, both sample images are in JPG- not PNG-format but this doesn’t appear to be the issue …

When saving sample “Svappa.jpg” as ImageJ “.raw”, it can properly be raw-imported to ImageJ, i.e. without any differences.

Perhaps you are considering a different kind of RAW-format.

I save the Svappa.jpg (or .png) from ImageJ to RAW.
When I directly after this operation opens the Svappa.raw just saved it looks different. (Like image number 2 in my original post)
It seems that something changes when saving to RAW? How can I change the raw format type within ImageJ ?

Have you used File>Import>Raw... to re-open your raw file in ImageJ?
Are the settings correct in the Raw Import dialog?

I have saved your test image as raw and can re-open it in ImageJ without difference between original and raw.

1 Like

@phaub , I did the same operation with my uploaded images here at the forum and alas!
Now it worked. :open_mouth:

The original image however is a .PNG and this leads to the strange behaviour.

Perfect image after I downloaded the images I eralier uploaded to the forum, conclusion: Dont start off with a .PNG

1 Like

That should not make any difference.

Well it does, it simply does not work with my .png
If I could upload the .png without the forum converting it to .jpg you could test it out. :slight_smile:

png-to-jpeg conversion is disabled on this forum, this is the current setting:

(… and this screenshot is actually in .png format :wink: )

How did you upload the png files? Which browser etc.? Maybe it’s a bug in the Discourse backend…

Running Edit › Copy to System in Fiji and pasting directly to the forum usually works fine for me, at least with Firefox or Chrome.

1 Like

It seems to have to do with your png file.

If I save your original posted jpeg test image as png, re-open the png in IJ and save it as raw, then the content of the raw image, opened in IJ, is identical to the png.
Here is the png version of your original text image:

1 Like

Thanks for your time, testing the issue.
Yes it must be something really weird going on. I use the GIS package “Microdem” to extract the area. Takes a copy of the map and pastes it into ImageJ. Then continue with the operation that fails. Must be something in the Copy/paste and related to the GIS program. I will try to do the same but save the image as a jpg first, then open it and convert it to raw.

I now have a pipeline I can work on, thanks for your help.

1 Like