Coder Social home page Coder Social logo

monostream / tifig Goto Github PK

View Code? Open in Web Editor NEW
407.0 18.0 50.0 39.5 MB

A fast HEIF image converter aimed at thumbnailing

License: Apache License 2.0

CMake 5.96% C++ 58.82% Python 9.82% C 0.24% Dockerfile 3.48% Shell 21.68%
heif jpeg image performance iphone ios vips ffmpeg libvips heic

tifig's People

Contributors

adrianliechti avatar bcherry avatar flask avatar lucidlemon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tifig's Issues

missing CMakeLists are blocking my build

CMake Error at CMakeLists.txt:60 (add_subdirectory):
The source directory

/building/graphics/tifig-0.2.1/lib/heif

does not contain a CMakeLists.txt file.

CMake Error at CMakeLists.txt:61 (add_subdirectory):
The source directory

/building/graphics/tifig-0.2.1/lib/cxxopts

does not contain a CMakeLists.txt file.

-- Configuring incomplete, errors occurred!

Image Quality

Thanks for this great tool which I am using on my Ubuntu server for automatic image processing
I am facing an issue with image quality though. Original images in heic format (from iPhone 7) look much more natural and vivid than their converted counterparts in jpg format.
I assume others observe this issue as well? Any idea about what we can do about it?

tifig for Centos

I'm trying to install tifig on Centos 7.
I have installed all dependencies, and the output of running "make" is:

[ 2%] Built target h265parser
[ 4%] Built target avcparser
[ 88%] Built target common
[ 91%] Built target heifreader
[ 92%] Building CXX object CMakeFiles/tifig.dir/src/main.cpp.o
In file included from /home/gec/tifig/src/loader.hpp:7:0,
from /home/gec/tifig/src/main.cpp:5:
/home/gec/tifig/src/hevc_decode.hpp: In function ‘RgbData decodeFrame(DataVector)’:
/home/gec/tifig/src/hevc_decode.hpp:83:40: error: ‘av_packet_alloc’ was not declared in this scope
AVPacket* packet = av_packet_alloc();
^
/home/gec/tifig/src/hevc_decode.hpp:89:45: error: ‘avcodec_send_packet’ was not declared in this scope
int sent = avcodec_send_packet(c, packet);
^
/home/gec/tifig/src/hevc_decode.hpp:97:49: error: ‘avcodec_receive_frame’ was not declared in this scope
int success = avcodec_receive_frame(c, frame);
^
make[2]: *** [CMakeFiles/tifig.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/tifig.dir/all] Error 2
make: *** [all] Error 2

I don't know what's the issue is. It seems like tifig does not support Centos.

macOS Sierra installation

This is not so much an issue as it is more instructions! I had to install some additional packages to get things working.

`

brew install cmake vips ffmpeg libxml2 zlib
setenv PKG_CONFIG_PATH /usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig
git clone --recursive https://github.com/monostream/tifig.git
mkdir tifig/build && cd tifig/build
cmake ..
make
`

SEGV on unknown address due to vulnerability in heif-forked lib

Greetings.
I researched this repo and crafted the malformed input which leads to crash at ItemDataBox::read(std::vector<unsigned char, std::allocator<unsigned char> >&, unsigned long, unsigned long) in lib/heif/Srcs/common/itemdatabox.cpp:25.

PoC: PoC.zip

Triggered by:

./tifig -v -p PoC.heic out.jpg
Segmentation fault

ASAN report:

$ ./tifig -v -p PoC.heic out.jpg
AddressSanitizer:DEADLYSIGNAL
=================================================================
==671204==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f2526563d82 bp 0x7ffd480017a0 sp 0x7ffd48000f08 T0)
==671204==The signal is caused by a READ memory access.
==671204==Hint: address points to the zero page.
    #0 0x7f2526563d81  (/lib/x86_64-linux-gnu/libc.so.6+0xbed81)
    #1 0x7f25287be36e  (/lib/x86_64-linux-gnu/libasan.so.5+0x9b36e)
    #2 0x559c6ae9c034 in unsigned char* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<unsigned char>(unsigned char const*, unsigned char const*, unsigned char*) /usr/include/c++/9/bits/stl_algobase.h:386
    #3 0x559c6ae9c034 in unsigned char* std::__copy_move_a<false, unsigned char const*, unsigned char*>(unsigned char const*, unsigned char const*, unsigned char*) /usr/include/c++/9/bits/stl_algobase.h:404
    #4 0x559c6ae9c034 in unsigned char* std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) /usr/include/c++/9/bits/stl_algobase.h:440
    #5 0x559c6ae9c034 in unsigned char* std::copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) /usr/include/c++/9/bits/stl_algobase.h:474
    #6 0x559c6ae9c034 in unsigned char* std::__uninitialized_copy<true>::__uninit_copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) /usr/include/c++/9/bits/stl_uninitialized.h:101
    #7 0x559c6ae9c034 in unsigned char* std::uninitialized_copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) /usr/include/c++/9/bits/stl_uninitialized.h:140
    #8 0x559c6ae9c034 in unsigned char* std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*, unsigned char>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*, std::allocator<unsigned char>&) /usr/include/c++/9/bits/stl_uninitialized.h:307
    #9 0x559c6ae9c034 in void std::vector<unsigned char, std::allocator<unsigned char> >::_M_range_insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > >(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, std::forward_iterator_tag) /usr/include/c++/9/bits/vector.tcc:778
    #10 0x559c6ae9c034 in void std::vector<unsigned char, std::allocator<unsigned char> >::_M_insert_dispatch<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > >(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, std::__false_type) /usr/include/c++/9/bits/stl_vector.h:1662
    #11 0x559c6ae9c034 in __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > > std::vector<unsigned char, std::allocator<unsigned char> >::insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, void>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >) /usr/include/c++/9/bits/stl_vector.h:1380
    #12 0x559c6ae9c034 in ItemDataBox::read(std::vector<unsigned char, std::allocator<unsigned char> >&, unsigned long, unsigned long) const /home/nale/tifig-0.2.3/lib/heif/Srcs/common/itemdatabox.cpp:25
    #13 0x559c6ad0e6df in HevcImageFileReader::readItem(MetaBox const&, unsigned int, std::vector<unsigned char, std::allocator<unsigned char> >&) const /home/nale/tifig-0.2.3/lib/heif/Srcs/reader/hevcimagefilereader.cpp:2016
    #14 0x559c6ad68a78 in HevcImageFileReader::loadItemData(MetaBox const&, unsigned int) const /home/nale/tifig-0.2.3/lib/heif/Srcs/reader/hevcimagefilereader.cpp:1965
    #15 0x559c6ad68a78 in HevcImageFileReader::extractItems(MetaBox const&, unsigned int) const /home/nale/tifig-0.2.3/lib/heif/Srcs/reader/hevcimagefilereader.cpp:1920
    #16 0x559c6ad75bd9 in HevcImageFileReader::readStream() /home/nale/tifig-0.2.3/lib/heif/Srcs/reader/hevcimagefilereader.cpp:1124
    #17 0x559c6ad7fcc3 in HevcImageFileReader::initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/nale/tifig-0.2.3/lib/heif/Srcs/reader/hevcimagefilereader.cpp:65
    #18 0x559c6ab46b74 in convert(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Opts&) /home/nale/tifig-0.2.3/src/main.cpp:49
    #19 0x559c6ab2d8f7 in main /home/nale/tifig-0.2.3/src/main.cpp:179
    #20 0x7f25264cc0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #21 0x559c6ab342cd in _start (/home/nale/tifig-0.2.3/build/tifig+0x5d2cd)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0xbed81) 
==671204==ABORTING

GDB info:

image

Your repo uses old version of heif lib check out the differences here (current heif) and here(updated heif).

Environment:
Host Operating System and version: Ubuntu 20.04.2 LTS
Host CPU architecture: x86_64

os x build issues

Hello.

I am trying to build on os x 10.13.1 (high sierra) and I am getting some errors:

Eriks-MBP:build eriks$ cmake ..
-- The C compiler identification is AppleClang 9.0.0.9000038
-- The CXX compiler identification is AppleClang 9.0.0.9000038
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/local/Cellar/cmake/3.9.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find LibAV (missing: LIBAV_INCLUDE_DIR) (found version "12.2")
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.9.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
  FindLibAV.cmake:220 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
See also "/Users/eriks/Documents/tifig/build/CMakeFiles/CMakeOutput.log".

I have installed both libav and vips through homebrew.

Release checksums

First of: I love this project. Thanks a lot for making it.

We have are making the binary release part of our installation, and in that we — usually — validate the the checksum of the downloaded tarbal. However it seems that each consecutive download of a released binary yields a different checksum.

This is a know issue with github releases: (https://github.com/sabotage-linux/sabotage/wiki/Why-github-downloads-suck) .

I have 3 suggestions to fix this:

  • Host the binaries somewhere else
  • Provide a checksum for the files IN the tarbal
  • Document that there is no checksum validation

MacOS Sierra make error (BUILD_STATIC)

Well cmake for static build goes well. But error occures during make

cmake -D STATIC_BUILD=ON ..

MacBook-Haha:build Haha$ cmake -D STATIC_BUILD=ON ..
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'libavcodec'
--   Found libavcodec, version 58.18.100
-- Checking for module 'libavutil'
--   Found libavutil, version 56.14.100
-- Checking for module 'libswscale'
--   Found libswscale, version 5.1.100
-- Checking for module 'vips-cpp'
--   Found vips-cpp, version 8.6.5
-- Checking for module 'expat'
--   Found expat, version 2.2.5
-- System name       : Darwin
-- Project Name      : HEIF
-- Project directory : /Users/Haha/Documents/UseTools/TifigSource/Tifig/lib/heif
-- Executables in    : /Users/Haha/Documents/UseTools/TifigSource/Tifig/lib/heif/Bins
-- File-list         : 
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Haha/Documents/UseTools/TifigSource/Tifig/build

during make, everything goes smooth until

[ 95%] Linking CXX executable tifig
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
ld: warning: option -s is obsolete and being ignored
ld: framework not found -lAudioToolbox
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [tifig] Error 1
make[1]: *** [CMakeFiles/tifig.dir/all] Error 2
make: *** [all] Error 2

Thanks for the HEIF conversion tool

In appreciation for the conversion tool, please accept this shell script which will run batch conversions from HEIF to JPG.

#!/bin/bash
find -name "* *" -type f | rename 's/ /_/g' #Changes Spaces to Underscores
IMAGES=$(ls *.HEIC | cut -d. -f1)
for IMAGE in $IMAGES
do
./tifig -i $IMAGE.HEIC -o $IMAGE.jpg
done
sleep 5
rm *.HEIC

Sincerely,

Paul B. Fedele

Please use CMake to install the binary

Hi,

I've uploaded tifig to Arch User Repository today: https://aur.archlinux.org/packages/tifig-git/ to make it accessible and available to the large Arch community. While it does install, I've had to install the binary manually since there's no install instructions. The install should be done by CMake through CMakeLists.txt to automate the process. I've installed the binary into /usr/bin/ as per Arch standards. If you end up creating more binaries or even add a man page, I'll have to edit this manually and that might take some time and inconvenience users. That's why it would be the best if you handle this yourselves.

More info on CMake install targets: https://cmake.org/cmake/help/latest/command/install.html#installing-targets

Arch packaging standards: https://wiki.archlinux.org/index.php/Arch_packaging_standards#Directories

Thanks!

make fails

make fails

-- Checking for one of the modules 'vips-cpp'
CMake Error at /usr/local/Cellar/cmake/3.9.3_1/share/cmake/Modules/FindPkgConfig.cmake:640 (message):
  None of the required 'vips-cpp' found
Call Stack (most recent call first):
  CMakeLists.txt:6 (pkg_search_module)

run tifig error

i run tifig throw exception :
terminate called after throwing an instance of 'std::regex_error'
what(): regex_error
gcc version 6.5.0 (GCC)
ffmpeg -version
libavutil 55. 27.100 / 55. 27.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 40.101 / 57. 40.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.102 / 6. 46.102
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100

who can i do to run tifig

could not make

Hi,
I'm running on:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

I followed the read me file instructions but could not make the binary:

Scanning dependencies of target tifig
[ 92%] Building CXX object CMakeFiles/tifig.dir/src/main.cpp.o
In file included from /home/yelena/tifig/src/loader.hpp:7:0,
from /home/yelena/tifig/src/main.cpp:5:
/home/yelena/tifig/src/hevc_decode.hpp: In function ‘RgbData decodeFrame(DataVector)’:
/home/yelena/tifig/src/hevc_decode.hpp:83:40: error: ‘av_packet_alloc’ was not declared in this scope
AVPacket* packet = av_packet_alloc();
^
/home/yelena/tifig/src/hevc_decode.hpp:89:45: error: ‘avcodec_send_packet’ was not declared in this scope
int sent = avcodec_send_packet(c, packet);
^
/home/yelena/tifig/src/hevc_decode.hpp:97:49: error: ‘avcodec_receive_frame’ was not declared in this scope
int success = avcodec_receive_frame(c, frame);
^
In file included from /home/yelena/tifig/src/loader.hpp:8:0,
from /home/yelena/tifig/src/main.cpp:5:
/home/yelena/tifig/src/imaging.hpp: In function ‘vips::VImage createVipsThumbnail(vips::VImage&, Opts&)’:
/home/yelena/tifig/src/imaging.hpp:45:39: error: ‘class vips::VImage’ has no member named ‘tiffsave_buffer’
VipsBlob* imgBlob = img.autorot().tiffsave_buffer(VImage::option()->set("strip", true));
^
/home/yelena/tifig/src/imaging.hpp:52:39: error: ‘VIPS_INTERESTING_CENTRE’ was not declared in this scope
thumbnailOptions->set("crop", VIPS_INTERESTING_CENTRE);
^
/home/yelena/tifig/src/imaging.hpp:55:12: error: ‘thumbnail_buffer’ is not a member of ‘vips::VImage’
return VImage::thumbnail_buffer(imgBlob, options.width, thumbnailOptions);
^
CMakeFiles/tifig.dir/build.make:62: recipe for target 'CMakeFiles/tifig.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/tifig.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/tifig.dir/all' failed
make[1]: *** [CMakeFiles/tifig.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Error in using examples

After the installation, which is ok, I ran next command:
tifig --version
tifig: command not found
When I used other variant:
./tifig --version
./tifig: symbol lookup error: ./tifig: undefined symbol: _ZN4vips6VImage16thumbnail_bufferEP9_VipsBlobiPNS_7VOptionE
Where may be the problem? guys?

Raspberry Pi

Has anyone had any luck using this on a Raspberry Pi? After a lot of trial and error I got it to build on one of my Pis but can't get it to make on another. I'm looking for advice on what I need to clone from one pi to another so I don't have to rebuild. Any advice?
thanks

error compile opensuse

-- The C compiler identification is GNU 10.1.1
-- The CXX compiler identification is GNU 10.1.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.6.3")
-- Checking for module 'libavcodec'
-- Found libavcodec, version 58.54.100
-- Checking for module 'libavutil'
-- Found libavutil, version 56.31.100
-- Checking for module 'libswscale'
-- Found libswscale, version 5.5.100
-- Checking for module 'vips-cpp'
-- Found vips-cpp, version 8.9.2
-- System name : Linux
-- Project Name : HEIF
-- Project directory : /home/oper/Programs/tifig/lib/heif
-- Executables in : /home/oper/Programs/tifig/lib/heif/Bins
-- File-list :
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.16") found components: doxygen dot
-- Configuring done
-- Generating done
-- Build files have been written to: /home/oper/Programs/tifig/build

[ 94%] Building CXX object CMakeFiles/tifig.dir/src/main.cpp.o /home/oper/Programs/tifig/src/main.cpp: In function ‘int convert(const string&, Opts&)’: /home/oper/Programs/tifig/src/main.cpp:58:26: warning: ‘void avcodec_register_all()’ is deprecated [-Wdeprecated-declarations] 58 | avcodec_register_all(); | ^ In file included from /home/oper/Programs/tifig/src/hevc_decode.hpp:9, from /home/oper/Programs/tifig/src/loader.hpp:7, from /home/oper/Programs/tifig/src/main.cpp:5: /usr/include/ffmpeg/libavcodec/avcodec.h:4159:6: note: declared here 4159 | void avcodec_register_all(void); | ^~~~~~~~~~~~~~~~~~~~ [ 95%] Linking CXX executable tifig /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/tifig.dir/src/main.cpp.o: in function createVipsThumbnail(vips::VImage&, Opts&)':
main.cpp:(.text+0x4018): undefined reference to vips::VImage::autorot(vips::VOption*)' /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: main.cpp:(.text+0x405c): undefined reference to vips::VImage::tiffsave_buffer(vips::VOption*)'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/tifig.dir/src/main.cpp.o: in function printOutputImageToStdout(vips::VImage&, Opts&)': main.cpp:(.text+0x4148): undefined reference to vips::VImage::jpegsave_buffer(vips::VOption*)'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/tifig.dir/src/main.cpp.o: in function getImage(HevcImageFileReader&, unsigned int, unsigned int, Opts&)': main.cpp:(.text+0x5347): undefined reference to vips::VImage::extract_area(int, int, int, int, vips::VOption*)'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/tifig.dir/src/main.cpp.o: in function saveOutputImageToFile(vips::VImage&, Opts&)': main.cpp:(.text+0x58a3): undefined reference to vips::VImage::jpegsave(char*, vips::VOption*)'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: main.cpp:(.text+0x59a8): undefined reference to vips::VImage::autorot(vips::VOption*)' /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: main.cpp:(.text+0x59ee): undefined reference to vips::VImage::tiffsave(char*, vips::VOption*)'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: main.cpp:(.text+0x5a22): undefined reference to vips::VImage::autorot(vips::VOption*)' /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: main.cpp:(.text+0x5a30): undefined reference to vips::VImage::pngsave(char*, vips::VOption*)'
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: main.cpp:(.text+0x5a6c): undefined reference to vips::VImage::autorot(vips::VOption*)' /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: main.cpp:(.text+0x5a7a): undefined reference to vips::VImage::ppmsave(char*, vips::VOption*)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/tifig.dir/build.make:111: tifig] Error 1
make[1]: *** [CMakeFiles/Makefile2:336: CMakeFiles/tifig.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
`

make error

I had solvled the problem by updating the ffmeg version to 3.1+...

Heap buffer overflow due to vulnerability in heif-forked lib

Greetings.
I researched this repo and crafted the malformed input which leads to crash (heap buffer overflow) at BitStream::extract(int, int, BitStream&) in lib/heif/Srcs/common/bitstream.cpp:109.

PoC: PoC.zip

Triggered by:

./tifig -v -p PoC.heic out.jpg
Segmentation fault

ASAN report:

$ ./tifig -v -p PoC.heic out.jpg
==717167==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x617000000da5 at pc 0x7fe3cb86d480 bp 0x7ffe8b6eb1a0 sp 0x7ffe8b6ea948
READ of size 1453 at 0x617000000da5 thread T0
    #0 0x7fe3cb86d47f  (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f)
    #1 0x5608d69b92fd in unsigned char* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<unsigned char>(unsigned char const*, unsigned char const*, unsigned char*) /usr/include/c++/9/bits/stl_algobase.h:386
    #2 0x5608d69b92fd in unsigned char* std::__copy_move_a<false, unsigned char const*, unsigned char*>(unsigned char const*, unsigned char const*, unsigned char*) /usr/include/c++/9/bits/stl_algobase.h:404
    #3 0x5608d69b92fd in unsigned char* std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) /usr/include/c++/9/bits/stl_algobase.h:440
    #4 0x5608d69b92fd in unsigned char* std::copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) /usr/include/c++/9/bits/stl_algobase.h:474
    #5 0x5608d69b92fd in unsigned char* std::__uninitialized_copy<true>::__uninit_copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) /usr/include/c++/9/bits/stl_uninitialized.h:101
    #6 0x5608d69b92fd in unsigned char* std::uninitialized_copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) /usr/include/c++/9/bits/stl_uninitialized.h:140
    #7 0x5608d69b92fd in unsigned char* std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*, unsigned char>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*, std::allocator<unsigned char>&) /usr/include/c++/9/bits/stl_uninitialized.h:307
    #8 0x5608d69b92fd in void std::vector<unsigned char, std::allocator<unsigned char> >::_M_range_insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > >(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, std::forward_iterator_tag) /usr/include/c++/9/bits/vector.tcc:778
    #9 0x5608d69b92fd in void std::vector<unsigned char, std::allocator<unsigned char> >::_M_insert_dispatch<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > >(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, std::__false_type) /usr/include/c++/9/bits/stl_vector.h:1662
    #10 0x5608d69b92fd in __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > > std::vector<unsigned char, std::allocator<unsigned char> >::insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, void>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >) /usr/include/c++/9/bits/stl_vector.h:1380
    #11 0x5608d69b92fd in BitStream::extract(int, int, BitStream&) const /home/nale/tifig-0.2.3/lib/heif/Srcs/common/bitstream.cpp:109
    #12 0x5608d69c7797 in BitStream::readSubBoxBitStream(FourCCInt&) /home/nale/tifig-0.2.3/lib/heif/Srcs/common/bitstream.cpp:404
    #13 0x5608d6a47d63 in ItemPropertiesBox::parseBox(BitStream&) /home/nale/tifig-0.2.3/lib/heif/Srcs/common/itempropertiesbox.cpp:120
    #14 0x5608d6a9f792 in MetaBox::parseBox(BitStream&) /home/nale/tifig-0.2.3/lib/heif/Srcs/common/metabox.cpp:250
    #15 0x5608d68ff9f4 in HevcImageFileReader::readStream() /home/nale/tifig-0.2.3/lib/heif/Srcs/reader/hevcimagefilereader.cpp:1119
    #16 0x5608d690bcc3 in HevcImageFileReader::initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/nale/tifig-0.2.3/lib/heif/Srcs/reader/hevcimagefilereader.cpp:65
    #17 0x5608d66d2b74 in convert(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Opts&) /home/nale/tifig-0.2.3/src/main.cpp:49
    #18 0x5608d66b98f7 in main /home/nale/tifig-0.2.3/src/main.cpp:179
    #19 0x7fe3c957b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #20 0x5608d66c02cd in _start (/home/nale/tifig-0.2.3/build/tifig+0x5d2cd)

0x617000000da5 is located 0 bytes to the right of 677-byte region [0x617000000b00,0x617000000da5)
allocated by thread T0 here:
    #0 0x7fe3cb8e1947 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0x10f947)
    #1 0x5608d69b925f in __gnu_cxx::new_allocator<unsigned char>::allocate(unsigned long, void const*) /usr/include/c++/9/ext/new_allocator.h:114
    #2 0x5608d69b925f in std::allocator_traits<std::allocator<unsigned char> >::allocate(std::allocator<unsigned char>&, unsigned long) /usr/include/c++/9/bits/alloc_traits.h:444
    #3 0x5608d69b925f in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate(unsigned long) /usr/include/c++/9/bits/stl_vector.h:343
    #4 0x5608d69b925f in void std::vector<unsigned char, std::allocator<unsigned char> >::_M_range_insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > >(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, std::forward_iterator_tag) /usr/include/c++/9/bits/vector.tcc:769
    #5 0x5608d69b925f in void std::vector<unsigned char, std::allocator<unsigned char> >::_M_insert_dispatch<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > >(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, std::__false_type) /usr/include/c++/9/bits/stl_vector.h:1662
    #6 0x5608d69b925f in __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > > std::vector<unsigned char, std::allocator<unsigned char> >::insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, void>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >) /usr/include/c++/9/bits/stl_vector.h:1380
    #7 0x5608d69b925f in BitStream::extract(int, int, BitStream&) const /home/nale/tifig-0.2.3/lib/heif/Srcs/common/bitstream.cpp:109

SUMMARY: AddressSanitizer: heap-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f) 
Shadow bytes around the buggy address:
  0x0c2e7fff8160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2e7fff8170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2e7fff8180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2e7fff8190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2e7fff81a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c2e7fff81b0: 00 00 00 00[05]fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fff81c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fff81d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fff81e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fff81f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fff8200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==717167==ABORTING

GDB info:

image

Your repo uses old version of heif lib, where BitStream::extract(int, int, BitStream&) in lib/heif/Srcs/common/bitstream.cpp:109 looks like:

void BitStream::extract(const int begin, const int end, BitStream& dest) const
{
    dest.clear();
    dest.reset();
    dest.mStorage.insert(dest.mStorage.begin(), mStorage.begin() + begin, mStorage.begin() + end); <-------This line is the source of heap buffer overflow in tifig
}

Just compare it with the latest version of the code in bitstream.cpp:

void BitStream::extract(const std::uint64_t begin, const std::uint64_t end, BitStream& dest) const
    {
        dest.clear();
        dest.reset();
        if (begin <= mStorage.size() && end <= mStorage.size() && begin <= end)
        {
            dest.mStorage.insert(dest.mStorage.begin(), mStorage.begin() + static_cast<std::int64_t>(begin),
                                 mStorage.begin() + static_cast<std::int64_t>(end));
        }
        else
        {
            throw RuntimeError("BitStream::readSubBoxBitStream trying to read 0 size box");
        }
    }

Environment:
Host Operating System and version: Ubuntu 20.04.2 LTS
Host CPU architecture: x86_64

Unknown image extension: HEIC

Hi

I ran the script in my folder and got the following error:
Unknown image extension: HEIC

arie@GoldenSavage:~/Desktop/Fotos/heic/Rebekka$ ll
total 50160
drwxrwxr-x 2 arie arie 4096 Jun 15 16:21 ./
drwxrwxr-x 3 arie arie 4096 Jun 15 16:20 ../
-rw-rw-r-- 1 arie arie 1547122 May 6 04:18 IMG_1194.HEIC
-rw-rw-r-- 1 arie arie 1151315 May 6 04:16 IMG_1195.HEIC
-rw-rw-r-- 1 arie arie 1773082 May 6 04:18 IMG_1196.HEIC
-rw-rw-r-- 1 arie arie 1256422 May 6 04:17 IMG_1198.HEIC
-rw-rw-r-- 1 arie arie 1370109 May 6 04:17 IMG_1199.HEIC
-rw-rw-r-- 1 arie arie 1418008 May 6 04:17 IMG_1200.HEIC
-rw-rw-r-- 1 arie arie 1335548 May 6 04:17 IMG_1205.HEIC
-rw-rw-r-- 1 arie arie 971385 May 6 04:16 IMG_1206.HEIC
-rw-rw-r-- 1 arie arie 1068914 May 6 04:16 IMG_1207.HEIC
-rw-rw-r-- 1 arie arie 1050094 May 6 04:16 IMG_1208.HEIC
-rw-rw-r-- 1 arie arie 1187759 May 6 04:17 IMG_1209.HEIC
-rw-rw-r-- 1 arie arie 1458044 May 6 04:17 IMG_1210.HEIC
-rw-rw-r-- 1 arie arie 1726010 May 6 04:18 IMG_1211.HEIC
-rw-rw-r-- 1 arie arie 1855143 May 6 04:18 IMG_1212.HEIC
-rw-rw-r-- 1 arie arie 1386354 May 6 04:17 IMG_1214.HEIC
-rw-rw-r-- 1 arie arie 1254815 May 6 04:17 IMG_1216.HEIC
-rw-rw-r-- 1 arie arie 1156828 May 6 04:16 IMG_1217.HEIC
-rw-rw-r-- 1 arie arie 1704071 May 6 04:18 IMG_1218.HEIC
-rw-rw-r-- 1 arie arie 1308802 May 6 04:17 IMG_1219.HEIC
-rw-rw-r-- 1 arie arie 1626304 May 6 04:18 IMG_1220.HEIC
-rw-rw-r-- 1 arie arie 1590175 May 6 04:18 IMG_1221.HEIC
-rw-rw-r-- 1 arie arie 1000708 May 6 04:16 IMG_1222.HEIC
-rw-rw-r-- 1 arie arie 1329382 May 6 04:17 IMG_1225.HEIC
-rw-rw-r-- 1 arie arie 1414910 May 6 04:17 IMG_1226.HEIC
-rw-rw-r-- 1 arie arie 1073486 May 6 04:16 IMG_1227.HEIC
-rw-rw-r-- 1 arie arie 1210023 May 6 04:17 IMG_1228.HEIC
-rw-rw-r-- 1 arie arie 1346041 May 6 04:17 IMG_1229.HEIC
-rw-rw-r-- 1 arie arie 1250884 May 6 04:16 IMG_1231.HEIC
-rw-rw-r-- 1 arie arie 1436782 May 6 04:48 IMG_1234.HEIC
-rw-rw-r-- 1 arie arie 1403447 May 6 04:48 IMG_1235.HEIC
-rw-rw-r-- 1 arie arie 1628385 May 6 04:48 IMG_1236.HEIC
-rw-rw-r-- 1 arie arie 1244669 May 6 04:48 IMG_1237.HEIC
-rw-rw-r-- 1 arie arie 1278101 May 6 04:48 IMG_1238.HEIC
-rw-rw-r-- 1 arie arie 1815457 May 6 04:48 IMG_1240.HEIC
-rw-rw-r-- 1 arie arie 1551286 May 6 04:48 IMG_1241.HEIC
-rw-rw-r-- 1 arie arie 1710882 May 6 04:54 IMG_1242.HEIC
-rw-rw-r-- 1 arie arie 1385728 May 6 04:54 IMG_1243.HEIC
arie@GoldenSavage:~/Desktop/Fotos/heic/Rebekka$ ~/Workspace/heic/tifig *
Unknown image extension: HEIC

use arrayjoin and sequential

Hello, I liked your converter. I noticed a couple of small things looking though the code:

  • You could use arrayjoin to improve the joining process. It can join any number of images into a rectangular grid in a single operation:

http://jcupitt.github.io/libvips/API/current/libvips-conversion.html#vips-arrayjoin

it should reduce memory use, and help the converter scale to larger images.

  • You could set the sequential access hint -- this would let libvips overlap decode and encode. Change new_from_file to be:
        VImage im = VImage::new_from_file(argv[1], VImage::option()->set("access", "sequential"));

it should produce a small speedup.

Fresh install from source crash on make process

I have followed the steps to build the tifig tool without success...
This is the make output

root@11308599ef5e:/home/lib/tifig/build# cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'libavcodec'
--   Found libavcodec, version 56.60.100
-- Checking for module 'libavutil'
--   Found libavutil, version 54.31.100
-- Checking for module 'libswscale'
--   Found libswscale, version 3.1.101
-- Checking for module 'vips-cpp'
--   Found vips-cpp, version 8.6.1
-- System name       : Linux
-- Project Name      : HEIF
-- Project directory : /home/lib/tifig/lib/heif
-- Executables in    : /home/lib/tifig/lib/heif/Bins
-- File-list         : 
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lib/tifig/build
root@11308599ef5e:/home/lib/tifig/build# make
Scanning dependencies of target h265parser
[  1%] Building CXX object lib/heif/Srcs/parser/h265parser/CMakeFiles/h265parser.dir/h265parser.cpp.o
[  2%] Linking CXX static library libh265parser.a
/usr/bin/ar qc libh265parser.a  CMakeFiles/h265parser.dir/h265parser.cpp.o
/usr/bin/ranlib libh265parser.a
[  2%] Built target h265parser
Scanning dependencies of target avcparser
[  3%] Building CXX object lib/heif/Srcs/parser/avcparser/CMakeFiles/avcparser.dir/avcparser.cpp.o
[  4%] Linking CXX static library libavcparser.a
/usr/bin/ar qc libavcparser.a  CMakeFiles/avcparser.dir/avcparser.cpp.o
/usr/bin/ranlib libavcparser.a
[  4%] Built target avcparser
Scanning dependencies of target common
[  5%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/auxiliarytypeproperty.cpp.o
[  7%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/avcconfigurationbox.cpp.o
[  8%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/avcdecoderconfigrecord.cpp.o
[  9%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/avcsampleentry.cpp.o
[ 10%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/bbox.cpp.o
[ 11%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/bitstream.cpp.o
[ 13%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/chunkoffsetbox.cpp.o
[ 14%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/cleanaperture.cpp.o
[ 15%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/codingconstraintsbox.cpp.o
[ 16%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/compositionoffsetbox.cpp.o
[ 17%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/compositiontodecodebox.cpp.o
[ 19%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/datainformationbox.cpp.o
[ 20%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/datareferencebox.cpp.o
[ 21%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/decodepts.cpp.o
[ 22%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/editbox.cpp.o
[ 23%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/entitytogroupbox.cpp.o
[ 25%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/filetypebox.cpp.o
[ 26%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/fourccint.cpp.o
[ 27%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/fullbox.cpp.o
[ 28%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/groupslistbox.cpp.o
[ 29%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/handlerbox.cpp.o
[ 30%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/hevcconfigurationbox.cpp.o
[ 32%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/hevcdecoderconfigrecord.cpp.o
[ 33%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/hevcsampleentry.cpp.o
[ 34%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/idspace.cpp.o
[ 35%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/imagemirror.cpp.o
[ 36%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/imagespatialextentsproperty.cpp.o
[ 38%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/imagerotation.cpp.o
[ 39%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/imagerelativelocationproperty.cpp.o
[ 40%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/imagegrid.cpp.o
[ 41%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/imageoverlay.cpp.o
[ 42%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/itemdatabox.cpp.o
[ 44%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/iteminfobox.cpp.o
[ 45%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/itemlocationbox.cpp.o
[ 46%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/itempropertiesbox.cpp.o
[ 47%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/itempropertyassociation.cpp.o
[ 48%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/itempropertycontainer.cpp.o
[ 50%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/itemprotectionbox.cpp.o
[ 51%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/itemreferencebox.cpp.o
[ 52%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/layeredhevcconfigurationitemproperty.cpp.o
[ 53%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/layerselectorproperty.cpp.o
[ 54%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/lhevcdecoderconfigrecord.cpp.o
[ 55%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/log.cpp.o
[ 57%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/mediabox.cpp.o
[ 58%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/mediadatabox.cpp.o
[ 59%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/mediaheaderbox.cpp.o
[ 60%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/mediainformationbox.cpp.o
[ 61%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/metabox.cpp.o
[ 63%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/moviebox.cpp.o
[ 64%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/movieheaderbox.cpp.o
[ 65%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/operatingpointsinformation.cpp.o
[ 66%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/primaryitembox.cpp.o
[ 67%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/protectionschemeinfobox.cpp.o
[ 69%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/sampledescriptionbox.cpp.o
[ 70%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/sampleentrybox.cpp.o
[ 71%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/samplesizebox.cpp.o
[ 72%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/sampletablebox.cpp.o
[ 73%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/sampletochunkbox.cpp.o
[ 75%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/sampletogroupbox.cpp.o
[ 76%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/samplegroupdescriptionbox.cpp.o
[ 77%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/samplegroupentry.cpp.o
[ 78%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/syncsamplebox.cpp.o
[ 79%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/targetolsproperty.cpp.o
[ 80%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/timetosamplebox.cpp.o
[ 82%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/trackbox.cpp.o
[ 83%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/trackheaderbox.cpp.o
[ 84%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/trackreferencebox.cpp.o
[ 85%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/trackreferencetypebox.cpp.o
[ 86%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/videomediaheaderbox.cpp.o
[ 88%] Building CXX object lib/heif/Srcs/common/CMakeFiles/common.dir/visualsampleentrybox.cpp.o
[ 89%] Linking CXX static library libcommon.a
/usr/bin/ar qc libcommon.a  CMakeFiles/common.dir/auxiliarytypeproperty.cpp.o CMakeFiles/common.dir/avcconfigurationbox.cpp.o CMakeFiles/common.dir/avcdecoderconfigrecord.cpp.o CMakeFiles/common.dir/avcsampleentry.cpp.o CMakeFiles/common.dir/bbox.cpp.o CMakeFiles/common.dir/bitstream.cpp.o CMakeFiles/common.dir/chunkoffsetbox.cpp.o CMakeFiles/common.dir/cleanaperture.cpp.o CMakeFiles/common.dir/codingconstraintsbox.cpp.o CMakeFiles/common.dir/compositionoffsetbox.cpp.o CMakeFiles/common.dir/compositiontodecodebox.cpp.o CMakeFiles/common.dir/datainformationbox.cpp.o CMakeFiles/common.dir/datareferencebox.cpp.o CMakeFiles/common.dir/decodepts.cpp.o CMakeFiles/common.dir/editbox.cpp.o CMakeFiles/common.dir/entitytogroupbox.cpp.o CMakeFiles/common.dir/filetypebox.cpp.o CMakeFiles/common.dir/fourccint.cpp.o CMakeFiles/common.dir/fullbox.cpp.o CMakeFiles/common.dir/groupslistbox.cpp.o CMakeFiles/common.dir/handlerbox.cpp.o CMakeFiles/common.dir/hevcconfigurationbox.cpp.o CMakeFiles/common.dir/hevcdecoderconfigrecord.cpp.o CMakeFiles/common.dir/hevcsampleentry.cpp.o CMakeFiles/common.dir/idspace.cpp.o CMakeFiles/common.dir/imagemirror.cpp.o CMakeFiles/common.dir/imagespatialextentsproperty.cpp.o CMakeFiles/common.dir/imagerotation.cpp.o CMakeFiles/common.dir/imagerelativelocationproperty.cpp.o CMakeFiles/common.dir/imagegrid.cpp.o CMakeFiles/common.dir/imageoverlay.cpp.o CMakeFiles/common.dir/itemdatabox.cpp.o CMakeFiles/common.dir/iteminfobox.cpp.o CMakeFiles/common.dir/itemlocationbox.cpp.o CMakeFiles/common.dir/itempropertiesbox.cpp.o CMakeFiles/common.dir/itempropertyassociation.cpp.o CMakeFiles/common.dir/itempropertycontainer.cpp.o CMakeFiles/common.dir/itemprotectionbox.cpp.o CMakeFiles/common.dir/itemreferencebox.cpp.o CMakeFiles/common.dir/layeredhevcconfigurationitemproperty.cpp.o CMakeFiles/common.dir/layerselectorproperty.cpp.o CMakeFiles/common.dir/lhevcdecoderconfigrecord.cpp.o CMakeFiles/common.dir/log.cpp.o CMakeFiles/common.dir/mediabox.cpp.o CMakeFiles/common.dir/mediadatabox.cpp.o CMakeFiles/common.dir/mediaheaderbox.cpp.o CMakeFiles/common.dir/mediainformationbox.cpp.o CMakeFiles/common.dir/metabox.cpp.o CMakeFiles/common.dir/moviebox.cpp.o CMakeFiles/common.dir/movieheaderbox.cpp.o CMakeFiles/common.dir/operatingpointsinformation.cpp.o CMakeFiles/common.dir/primaryitembox.cpp.o CMakeFiles/common.dir/protectionschemeinfobox.cpp.o CMakeFiles/common.dir/sampledescriptionbox.cpp.o CMakeFiles/common.dir/sampleentrybox.cpp.o CMakeFiles/common.dir/samplesizebox.cpp.o CMakeFiles/common.dir/sampletablebox.cpp.o CMakeFiles/common.dir/sampletochunkbox.cpp.o CMakeFiles/common.dir/sampletogroupbox.cpp.o CMakeFiles/common.dir/samplegroupdescriptionbox.cpp.o CMakeFiles/common.dir/samplegroupentry.cpp.o CMakeFiles/common.dir/syncsamplebox.cpp.o CMakeFiles/common.dir/targetolsproperty.cpp.o CMakeFiles/common.dir/timetosamplebox.cpp.o CMakeFiles/common.dir/trackbox.cpp.o CMakeFiles/common.dir/trackheaderbox.cpp.o CMakeFiles/common.dir/trackreferencebox.cpp.o CMakeFiles/common.dir/trackreferencetypebox.cpp.o CMakeFiles/common.dir/videomediaheaderbox.cpp.o CMakeFiles/common.dir/visualsampleentrybox.cpp.o
/usr/bin/ranlib libcommon.a
[ 89%] Built target common
Scanning dependencies of target heifreader
[ 90%] Building CXX object lib/heif/Srcs/reader/CMakeFiles/heifreader.dir/hevcimagefilereader.cpp.o
[ 91%] Building CXX object lib/heif/Srcs/reader/CMakeFiles/heifreader.dir/imagefilereaderfactory.cpp.o
[ 92%] Linking CXX static library libheifreader.a
/usr/bin/ar qc libheifreader.a  CMakeFiles/heifreader.dir/hevcimagefilereader.cpp.o CMakeFiles/heifreader.dir/imagefilereaderfactory.cpp.o
/usr/bin/ranlib libheifreader.a
[ 92%] Built target heifreader
Scanning dependencies of target tifig
[ 94%] Building CXX object CMakeFiles/tifig.dir/src/main.cpp.o
In file included from /home/lib/tifig/src/loader.hpp:7:0,
                 from /home/lib/tifig/src/main.cpp:5:
/home/lib/tifig/src/hevc_decode.hpp: In function 'RgbData decodeFrame(DataVector)':
/home/lib/tifig/src/hevc_decode.hpp:83:40: error: 'av_packet_alloc' was not declared in this scope
     AVPacket* packet = av_packet_alloc();
                                        ^
/home/lib/tifig/src/hevc_decode.hpp:89:45: error: 'avcodec_send_packet' was not declared in this scope
     int sent = avcodec_send_packet(c, packet);
                                             ^
/home/lib/tifig/src/hevc_decode.hpp:97:49: error: 'avcodec_receive_frame' was not declared in this scope
     int success = avcodec_receive_frame(c, frame);
                                                 ^
CMakeFiles/tifig.dir/build.make:62: recipe for target 'CMakeFiles/tifig.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/tifig.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/tifig.dir/all' failed
make[1]: *** [CMakeFiles/tifig.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

My env (docker container)

make

root@11308599ef5e:/home# make -v
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

SO: Ubuntu 16.04 (LTS)

ffmpeg

root@11308599ef5e:/home# ffmpeg -version
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil      54. 31.100 / 54. 31.100
libavcodec     56. 60.100 / 56. 60.100
libavformat    56. 40.101 / 56. 40.101
libavdevice    56.  4.100 / 56.  4.100
libavfilter     5. 40.101 /  5. 40.101
libavresample   2.  1.  0 /  2.  1.  0
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  2.101 /  1.  2.101
libpostproc    53.  3.100 / 53.  3.100

Also, I have tried to use the binary directly, but the tool output show me this:

root@11308599ef5e:/home# ./tifig  -v -p image.heic out.jpg
No ftyp box found! This cannot be a HEIF image.

This is the image that I'm using:
https://drive.google.com/open?id=1N193Zf4NO7EsMzW28O3JD7OUwUoMq_0P

Any idea how to get running tifig ?

Regards

Compile error

Hi,

I am getting following error, any idea what can be wrong?

[ 96%] Building CXX object lib/heif/Srcs/jsonlib/CMakeFiles/json.dir/jsoncpp.cpp.o
/home/ronny/tifig/lib/heif/Srcs/jsonlib/jsoncpp.cpp: In member function ‘bool Json::OurReader::readToken(Json::OurReader::Token&)’:
/home/ronny/tifig/lib/heif/Srcs/jsonlib/jsoncpp.cpp:1444:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
     if (features_.allowSingleQuotes_) {
     ^~
/home/ronny/tifig/lib/heif/Srcs/jsonlib/jsoncpp.cpp:1449:3: note: here
   case '/':
   ^~~~
cc1plus: all warnings being treated as errors
lib/heif/Srcs/jsonlib/CMakeFiles/json.dir/build.make:65: recipe for target 'lib/heif/Srcs/jsonlib/CMakeFiles/json.dir/jsoncpp.cpp.o' failed
make[2]: *** [lib/heif/Srcs/jsonlib/CMakeFiles/json.dir/jsoncpp.cpp.o] Error 1
CMakeFiles/Makefile2:226: recipe for target 'lib/heif/Srcs/jsonlib/CMakeFiles/json.dir/all' failed
make[1]: *** [lib/heif/Srcs/jsonlib/CMakeFiles/json.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Here are needed libraries:

ii  libexif-dev:amd64                          0.6.21-2.1                                  amd64        library to parse EXIF files (development files)
ii  libswscale-dev:amd64                       7:3.3.4-2                                   amd64        FFmpeg library for image scaling and various conversions - development files
ii  libavcodec-dev:amd64                       7:3.3.4-2                                   amd64        FFmpeg library with de/encoders for audio/video codecs - development files
ii  libvips-dev                                8.5.7-1dhor~artful                          amd64        image processing system good for very large images (dev)

Taking input from stdin

Hi!

I saw #18 which deals with outputting to stdout, are there any plans to update the tool to allow reading the image from stdin instead of a file?

When shelling out to tifig from other languages it's nice to be able to provide the input via stdin, since sometime the image is already in memory. Currently, the calling program has to create a temporary file and put the image in there for tifig to read from.

rotate is broken since 0.2.2

Sample image:
https://www.jottacloud.com/p/fazermint82/40c6ccc110bd46f69b4cc857702b0c3d

run:
tifig -i test.heic -o test.heic.jpeg

The image is not rotated, the metadata embedded is also incorrect:

Eriks-iMac:Downloads erik$ exiftool -j -n test.heic.jpeg 
[{
  "SourceFile": "test.heic.jpeg",
  "ExifToolVersion": 10.78,
  "FileName": "test.heic.jpeg",
  "Directory": ".",
  "FileSize": 3604479,
  "FileModifyDate": "2018:02:20 15:16:36+01:00",
  "FileAccessDate": "2018:02:20 15:16:39+01:00",
  "FileInodeChangeDate": "2018:02:20 15:16:38+01:00",
  "FilePermissions": 644,
  "FileType": "JPEG",
  "FileTypeExtension": "JPG",
  "MIMEType": "image/jpeg",
  "JFIFVersion": "1 1",
  "ExifByteOrder": "MM",
  "Orientation": 1,
  "XResolution": 25.4,
  "YResolution": 25.4,
  "ResolutionUnit": 2,
  "ExifImageWidth": 4032,
  "ExifImageHeight": 3024,
  "ImageWidth": 4032,
  "ImageHeight": 3024,
  "EncodingProcess": 0,
  "BitsPerSample": 8,
  "ColorComponents": 3,
  "YCbCrSubSampling": "2 2",
  "ImageSize": "4032x3024",
  "Megapixels": 12.192768
}]

I get the same result with tiff and png.

Regards Erik

Cannot compile on Ubuntu 18.04

dave@bionic:~/tifig/build$ cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'libavcodec'
--   Found libavcodec, version 57.107.100
-- Checking for module 'libavutil'
--   Found libavutil, version 55.78.100
-- Checking for module 'libswscale'
--   Found libswscale, version 4.8.100
-- Checking for module 'vips-cpp'
--   Found vips-cpp, version 8.7.0
CMake Error at CMakeLists.txt:56 (add_subdirectory):
  The source directory

    /home/dave/tifig/lib/heif

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:57 (add_subdirectory):
  The source directory

    /home/dave/tifig/lib/cxxopts

  does not contain a CMakeLists.txt file.


-- Configuring incomplete, errors occurred!
See also "/home/dave/tifig/build/CMakeFiles/CMakeOutput.log".

Thank you!

Just wanted to say thank you for putting this together. It's working great for us and will be a huge asset in our media processing going forward 👍

No package 'vips-cpp' found

I work on Mac OSX High Sierra. After install vips and ffmpeg via
$ brew install vips ffmpeg
I tried to build tifig. However, the following error happened during cmake
$ cmake ..
-- Checking for module 'vips-cpp'
-- No package 'vips-cpp' found
CMake Error at /usr/local/Cellar/cmake/3.6.2/share/cmake/Modules/FindPkgConfig.cmake:424 (message):
A required package was not found

Hope some one can help. Thanks.

to rotate or not to rotate

Looking at your commit log I see you try to rotate the images based on its metadata:
5697f12

However, after testing the output from your binary this does not seem to be the case. The orientation tag is passed to the metadata of the output image, and the image is not rotated. This looks like the desired behaviour if you do not intend to rotate the image.

Is this intentional?

what(): regex_error

/usr/local/bin/tifig -v -p IMG_2281.HEIC out.jpg
terminate called after throwing an instance of 'std::regex_error'
what(): regex_error
Aborted (core dumped)

what is wrong ?

question on license

This project is licensed under APL, which allows commercial usage.

In readme file, you put a link to Nokia HEIF library. However, that project limits the license to non-commercial usage only.

So I wonder if you used code directly from that library? Or you re-write corresponding codes and have the copyright as your own. We want to use tifig in a commercial product (a home nas) and don't want to receive letters from Nokia's lawyer. :)

Can I convert other (not from ios 11 devices) heif picture?

when I try to convert a picture (not ios 11), I get error info:

Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

Any possible could I make it?
That's be so kind as to give me a reply.

Install Error - Local Variable 't'

Attempting to install on Mac OS Catalina with latest git clone:

mkdir tifig/build
cd tifig/build && cmake ..

-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Checking for module 'libavcodec'
--   Found libavcodec, version 58.54.100
-- Checking for module 'libavutil'
--   Found libavutil, version 56.31.100
-- Checking for module 'libswscale'
--   Found libswscale, version 5.5.100
-- Checking for module 'vips-cpp'
--   Found vips-cpp, version 8.8.3
-- System name       : Darwin
-- Project Name      : HEIF
-- Project directory : /Users/eunancamilleri/git/tifig/lib/heif
-- Executables in    : /Users/eunancamilleri/git/tifig/lib/heif/Bins
-- File-list         :
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written

then make results in the following output:

Scanning dependencies of target json
[ 96%] Building CXX object lib/heif/Srcs/jsonlib/CMakeFiles/json.dir/jsoncpp.cpp.o
[ 97%] Linking CXX static library libjson.a
/Library/Developer/CommandLineTools/usr/bin/ar qc libjson.a  CMakeFiles/json.dir/jsoncpp.cpp.o
/Library/Developer/CommandLineTools/usr/bin/ranlib libjson.a
[ 97%] Built target json
Scanning dependencies of target example
[ 98%] Building CXX object lib/cxxopts/src/CMakeFiles/example.dir/example.cpp.o
In file included from tifig/lib/cxxopts/src/example.cpp:27:
tifig/lib/cxxopts/include/cxxopts.hpp:195:12: error: local variable 't' will be copied despite being returned by name
      [-Werror,-Wreturn-std-move]
    return t;
           ^
tifig/lib/cxxopts/include/cxxopts.hpp:909:21: note: in instantiation of function template specialization
      'cxxopts::toLocalString<std::__1::basic_string<char> >' requested here
    , m_help_string(toLocalString(std::move(help_string)))
                    ^
tifig/lib/cxxopts/include/cxxopts.hpp:195:12: note: call 'std::move' explicitly to avoid copying
    return t;
           ^
           std::move(t)
1 error generated.
make[2]: *** [lib/cxxopts/src/CMakeFiles/example.dir/example.cpp.o] Error 1
make[1]: *** [lib/cxxopts/src/CMakeFiles/example.dir/all] Error 2
make: *** [all] Error 2

tifig can't converting heif files from https://github.com/nokiatech/heif_conformance/tree/master/conformance_files to jpeg files

Hi monostream,,

The following are log messages about converting heif files from https://github.com/nokiatech/heif_conformance/tree/master/conformance_files to jpeg files..

https://github.com/nokiatech/heif_conformance/tree/master/conformance_files

build/tifig -i conformance_files/C020.heic -o conformance_files/C020.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C017.heic -o conformance_files/C017.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C033.heic -o conformance_files/C033.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C026.heic -o conformance_files/C026.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C002.heic -o conformance_files/C002.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C004.heic -o conformance_files/C004.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C019.heic -o conformance_files/C019.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C009.heic -o conformance_files/C009.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C031.heic -o conformance_files/C031.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C011.heic -o conformance_files/C011.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C023.heic -o conformance_files/C023.jpg
Exif Data ID (cdsc) not found!
build/tifig -i conformance_files/C032.heic -o conformance_files/C032.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C003.heic -o conformance_files/C003.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C024.heic -o conformance_files/C024.jpg
Exif Data ID (cdsc) not found!
build/tifig -i conformance_files/multilayer005.heic -o conformance_files/multilayer005.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C005.heic -o conformance_files/C005.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C027.heic -o conformance_files/C027.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/multilayer004.heic -o conformance_files/multilayer004.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C021.heic -o conformance_files/C021.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C008.heic -o conformance_files/C008.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C025.heic -o conformance_files/C025.jpg
Exif Data ID (cdsc) not found!
build/tifig -i conformance_files/C038.heic -o conformance_files/C038.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C028.heic -o conformance_files/C028.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C013.heic -o conformance_files/C013.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C029.heic -o conformance_files/C029.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/multilayer003.heic -o conformance_files/multilayer003.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C036.heic -o conformance_files/C036.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C037.heic -o conformance_files/C037.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C040.heic -o conformance_files/C040.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C042.heic -o conformance_files/C042.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C022.heic -o conformance_files/C022.jpg
Exif Data ID (cdsc) not found!
build/tifig -i conformance_files/C001.heic -o conformance_files/C001.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C039.heic -o conformance_files/C039.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C041.heic -o conformance_files/C041.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C012.heic -o conformance_files/C012.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C007.heic -o conformance_files/C007.jpg
Exif Data ID (cdsc) not found!
build/tifig -i conformance_files/C018.heic -o conformance_files/C018.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C030.heic -o conformance_files/C030.jpg
Could not read HEIF image: Invalid context ID parameter.
build/tifig -i conformance_files/C006.heic -o conformance_files/C006.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C010.heic -o conformance_files/C010.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C014.heic -o conformance_files/C014.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/multilayer002.heic -o conformance_files/multilayer002.jpg
Exif Data ID (cdsc) not found!
build/tifig -i conformance_files/C034.heic -o conformance_files/C034.jpg
Could not read HEIF image: No compatible brands in file
build/tifig -i conformance_files/C016.heic -o conformance_files/C016.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/multilayer001.heic -o conformance_files/multilayer001.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new
build/tifig -i conformance_files/C015.heic -o conformance_files/C015.jpg
Grid configuration not found! tifig currently only supports .heic images created on iOS 11 devices.
If you are certain this image was created on iOS 11, please open an issue here:

https://github.com/monostream/tifig/issues/new

Do you have plan to support files from https://github.com/nokiatech/heif_conformance/tree/master/conformance_files?

snowuyl

How to run it in Alpine ?

My project is running in prod environment with Alpine docker image node:8.9.4-alpine.
The packages scpecified here https://github.com/monostream/tifig#linux most of them are not valid Alpine packages.
Do I have to take other instructions into account?

Thanks for all, I ran it in ubuntu and worked perfectly.
👍

where does your cxxopts.hpp come from?

Where does your cxxopts.hpp come from?

Version 2.0.0 from
https://github.com/jarro2783/cxxopts/releases
gives these errors:
/building/graphics/tifig-0.2.1/src/main.cpp:106:17: error: ‘class cxxopts::Options’ has no member named ‘count’
if (options.count("output"))
^~~~~
/building/graphics/tifig-0.2.1/src/main.cpp:107:34: error: no match for ‘operator[]’ (operand types are ‘cxxopts::Options’ and ‘const char [7]’)
opts.outputPath = options["output"].as();
^
/building/graphics/tifig-0.2.1/src/main.cpp:107:54: error: expected primary-expression before ‘>’ token
opts.outputPath = options["output"].as();
^
/building/graphics/tifig-0.2.1/src/main.cpp:107:56: error: expected primary-expression before ‘)’ token
opts.outputPath = options["output"].as();
plus a few dozen more.

Also,
git sources for heif are giving this error:
building/graphics/tifig-0.2.1/src/loader.hpp:65:93: error: no matching function for call to ‘HevcImageFileReader::getItemDataWithDecoderParameters(uint32_t&, uint32_t&, uint32_t&, DataVector&)’
reader.getItemDataWithDecoderParameters(contextId, tileItemId, firstTileId, hevcData);
^
In file included from /building/graphics/tifig-0.2.1/src/types.hpp:4:0,
from /building/graphics/tifig-0.2.1/src/heif.hpp:4,
from /building/graphics/tifig-0.2.1/src/loader.hpp:6,
from /building/graphics/tifig-0.2.1/src/main.cpp:5:
/usr/include/heif/hevcimagefilereader.hpp:132:18: note: candidate: virtual void HevcImageFileReader::getItemDataWithDecoderParameters(uint32_t, uint32_t, ImageFileReaderInterface::DataVector&)
virtual void getItemDataWithDecoderParameters(std::uint32_t contextId, std::uint32_t itemId,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/heif/hevcimagefilereader.hpp:132:18: note: candidate expects 3 arguments, 4 provided

Can't load photo from iPhone

Hi, I'm trying to use tifig to convert from HEIC to JPG but I'm getting the following error:

./tifig -i IMG_6012.HEIC -o IMG_6012.jpg
No ftyp box found! This cannot be a HEIF image.

Do you know what could be going on?

Can you make a NuGet library?

I am working on a hobby project of mine and for the past 6 months i have been looking for a C# library to decode/encode image collection into a HEIC container. sadly the only libraries out there only decode the main image.
I have tried PInvoke the library using SWIG but I still haven't managed to do it with LIBHEIF or tifig.
can you please help and make it possible to access the tools of the library through C# ?
Again.. My goal is to decode/encode several images (with thumbnails) into a HEIC container.

Missing dependency - vips

Hi,

It appears that AUR repository no longer has vips, because of that I can no longer install tifig-git on my Manjaro Linux.

Best wishes,
D.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.