I still get LIBRAW_THUMBNAIL_UNKNOWN from master branch

I got the latest master branch, and when I decode the thumbnail for newer cameras such as Sony A73 and Fuji X-H1, thumbnail.tformat still returns LIBRAW_THUMBNAIL_UNKNOWN.

rawProcessor->unpack_thumb() does return LIBRAW_SUCCESS.

Despite getting LIBRAW_THUMBNAIL_UNKNOWN, I go ahead and treat it as LIBRAW_THUMBNAIL_JPEG and I was able to get the thumbnail (preview image) successfully.

I thought those newer cameras are supported in the master branch, so why am I still get LIBRAW_THUMBNAIL_UNKNOWN return code?

Forums: 

Dear Sir:

Dear Sir:
We tried to reproduce the problem:
- fetched LibRaw/master from github to make sure
- compiled it with MSVC 2013.
- selected some sample files (Sony A7-3, Fuji X-H1):

raw-identify.exe fuji_xh1_compressed.RAF fuji_xh1_uncompressed.RAF _DSC0010.ARW UNCOMPRESSED_14bit.ARW:

fuji_xh1_compressed.RAF is a Fujifilm X-H1 image.
fuji_xh1_uncompressed.RAF is a Fujifilm X-H1 image.
_DSC0010.ARW is a Sony ILCE-7M3 image.
UNCOMPRESSED_14bit.ARW is a Sony ILCE-7M3 image.

Than I've modified simple_dcraw.cpp sample to print (numerical) format ID:

diff --git a/samples/simple_dcraw.cpp b/samples/simple_dcraw.cpp
index 47c329a..b079a9f 100644
--- a/samples/simple_dcraw.cpp
+++ b/samples/simple_dcraw.cpp
@@ -145,7 +145,7 @@ int main(int ac, char *av[])
T.tformat == LIBRAW_THUMBNAIL_JPEG ? "thumb.jpg" : "thumb.ppm");

if (verbose)
- printf("Writing thumbnail file %s\n", thumbfn);
+ printf("Writing thumbnail file %s with format: %d\n", thumbfn,T.tformat);
if (LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_thumb_writer(thumbfn)))
{
fprintf(stderr, "Cannot write %s: %s\n", thumbfn, libraw_strerror(ret));

And here is the results:
simple_dcraw.exe -v -e _DSC0010.ARW fuji_xh1_compressed.RAF fuji_xh1_uncompressed.RAF UNCOMPRESSED_14bit.ARW:
Processing file _DSC0010.ARW
Writing thumbnail file _DSC0010.ARW.thumb.jpg with format: 1
Processing file fuji_xh1_compressed.RAF
Writing thumbnail file fuji_xh1_compressed.RAF.thumb.jpg with format: 1
Processing file fuji_xh1_uncompressed.RAF
Writing thumbnail file fuji_xh1_uncompressed.RAF.thumb.jpg with format: 1
Processing file UNCOMPRESSED_14bit.ARW
Writing thumbnail file UNCOMPRESSED_14bit.ARW.thumb.jpg with format: 1

From libraw_const.h:

enum LibRaw_thumbnail_formats
{
LIBRAW_THUMBNAIL_UNKNOWN = 0,
LIBRAW_THUMBNAIL_JPEG = 1,

So, all thumbnails format reported is LIBRAW_THUMBNAIL_JPEG

Please make sure you compile the library and your app with same libraw.h

-- Alex Tutubalin

What am I doing wrong?

I'm running macOS 10.13.6.

I pulled the master branch, and "git branch" returned "* master". ./version.sh returned 0.19.0-Beta1

I ran ./mkdist.sh (since there is no configure file). I could see that mkdist.sh called wget and wiped out dcraw.c in the dcraw directory with an older version.

After that, I just ran "./configure". I removed -DUSE_JASPER and added -DUSER_ZLIB.

I then performed "make" and "sudo make install".

The .h files are up-to-date. And I'm still seeing LIBRAW_THUMBNAIL_UNKNOWN

No idea why at this point.

Kuro

Could you please apply the

Could you please apply the patch shown above (print T.tformat in simple_dcraw -e) and check is tformat is really not 1.
Just change the line:
printf("Writing thumbnail file......
to
printf("Writing thumbnail file %s with format: %d\n", thumbfn,T.tformat);

-- Alex Tutubalin

Just tried that, simple_dcraw

Just tried that, simple_dcraw returns 0 for Sony A73 ARW file...

Could you check it under macOS yourself?

Edit: simple_dcraw -L does return Sony A7 III as support camera

Kuro

It just works as expected:

It just works as expected:

$ git clone https://github.com/LibRaw/LibRaw.git LibRaw-github
$ cd LibRaw-github
 
# edited simple_dcraw to get format printed:
$ git diff
diff --git a/samples/simple_dcraw.cpp b/samples/simple_dcraw.cpp
index 47c329a..78f14f0 100644
--- a/samples/simple_dcraw.cpp
+++ b/samples/simple_dcraw.cpp
@@ -145,7 +145,7 @@ int main(int ac, char *av[])
                  T.tformat == LIBRAW_THUMBNAIL_JPEG ? "thumb.jpg" : "thumb.ppm");
 
         if (verbose)
-          printf("Writing thumbnail file %s\n", thumbfn);
+          printf("Writing thumbnail file %s format: %d\n", thumbfn, T.tformat);
         if (LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_thumb_writer(thumbfn)))
         {
           fprintf(stderr, "Cannot write %s: %s\n", thumbfn, libraw_strerror(ret));
 
# no autotools here, so just:
$ make -f Makefile.dist
 
# identify files:
$ ./bin/raw-identify ~/smpl/*
/Users/lexa/smpl/UNCOMPRESSED_14bit.ARW is a Sony ILCE-7M3 image.
/Users/lexa/smpl/_DSC0010.ARW is a Sony ILCE-7M3 image.
/Users/lexa/smpl/fuji_xh1_compressed.RAF is a Fujifilm X-H1 image.
/Users/lexa/smpl/fuji_xh1_uncompressed.RAF is a Fujifilm X-H1 image.
 
# run simple_dcraw -e -v:
$ ./bin/simple_dcraw -v -e ~/smpl/*
Processing file /Users/lexa/smpl/UNCOMPRESSED_14bit.ARW
Writing thumbnail file /Users/lexa/smpl/UNCOMPRESSED_14bit.ARW.thumb.jpg format: 1
Processing file /Users/lexa/smpl/_DSC0010.ARW
Writing thumbnail file /Users/lexa/smpl/_DSC0010.ARW.thumb.jpg format: 1
Processing file /Users/lexa/smpl/fuji_xh1_compressed.RAF
Writing thumbnail file /Users/lexa/smpl/fuji_xh1_compressed.RAF.thumb.jpg format: 1
Processing file /Users/lexa/smpl/fuji_xh1_uncompressed.RAF
Writing thumbnail file /Users/lexa/smpl/fuji_xh1_uncompressed.RAF.thumb.jpg format: 1

-- Alex Tutubalin

And system info:

And system info:

$ uname -a
Darwin OSX10-10.local 17.7.0 Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT 2018; root:xnu-4570.71.13~1/RELEASE_X86_64 x86_64
 
$ gcc  -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

-- Alex Tutubalin

Thanks

Using your make procedure works!

But the document on this site says run ./configure, and since there is no configure file, I run mkdist.sh and it does create one.

Could you please update the build procedure?

Many thanks.

Kuro

LibRaw 0.19.2 + provided .

LibRaw 0.19.2 + provided ./configure works fine too (thumbnail extraction works even for not supported cameras in most cases).
We're not responsible if one
- use unknown version of autotools
- modifies ./configure results.

-- Alex Tutubalin