5
$\begingroup$

I can import 70000 x 2MB TIFF images (~140GB) using

Image`ImportExportDump`ImageReadTIFF

in about 3 minutes based on @Szabolcs solution to this question by @Kagaratsch which is fantastic.

However, the image data is converted to floating point numbers <1.

Is there an option for Image`ImportExportDump`ImageReadTIFF which will preserve the original integer image data?

I tried using the options "Data", "Bit16", "Automatic" which returned $Failed.

$\endgroup$
7
  • $\begingroup$ Hard to help without the actual file. Can you upload your image somewhere and post a link? $\endgroup$
    – M.R.
    Commented Oct 30, 2018 at 17:15
  • $\begingroup$ Please try to put a TIFF file somewhere we can access it, then include code that shows what you expect to get back and what you actually get back. $\endgroup$
    – Jason B.
    Commented Oct 30, 2018 at 18:26
  • $\begingroup$ @DrBubbles you posted a PNG not a TIFF $\endgroup$
    – M.R.
    Commented Oct 30, 2018 at 18:34
  • $\begingroup$ Sorry, I will generate one inline when I get back to my desk $\endgroup$
    – DrBubbles
    Commented Oct 30, 2018 at 18:37
  • 1
    $\begingroup$ @DrBubbles - if you solved your problem, consider moving the Update section to a self-answer if you think this will help someone in the future. $\endgroup$
    – Jason B.
    Commented Oct 30, 2018 at 19:18

1 Answer 1

5
$\begingroup$

Update: Just found the problem was my use of ImageData[]. I thought I needed to export the data with "Bit16", I didn't realize (or forgot) I needed to use it with ImageData[] too. Now I get the expected 16 bit integers in import using Image`ImportExportDump`ImageReadTIFF :

SetDirectory[NotebookDirectory[]];
im1 = Image[RandomInteger[{0, 65535}, {512, 512}], "Bit16"];
Export["im1.tiff", im1];
im2 = Image`ImportExportDump`ImageReadTIFF[
AbsoluteFileName["im1.tiff"]][[1]];
ImageData[im1, "Bit16"][[1, 1]]
ImageData[im2, "Bit16"][[1, 1]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.