simon987 / sist2

Lightning-fast file system indexer and search tool
GNU General Public License v3.0
843 stars 55 forks source link

Support Heic format #444

Open ffchung opened 9 months ago

ffchung commented 9 months ago

Which SIST2 component is your Feature Request related to?

Scan

Is your feature request related to a problem? Please describe.

I have more Heic file. Heic format is becoming more popular among mobile users these days. I wish your app could support Heic format too. Thanks.

What would you like to see happen?

Suppot Heic.

Additional context

ffchung commented 8 months ago

libheif : https://github.com/strukturag/libheif

Ref : https://github.com/strukturag/libheif/blob/master/examples/heif_convert.cc

`

include <libheif/heif.h>

bool decodeheif(string filename) { heif_context* heifctx = heif_context_alloc(); if (!heifctx) return false;

// read heif file
heif_error error = heif_context_read_from_file(heif_ctx_, filename.c_str), nullptr);
if (error.code != heif_error_Ok) return false;

// get handler
heif_image_handle *heit_handle_ = nullptr;
error = heif_context_get_primary_image_handle(heif_ctx_, &heif_handle_);
if (error.code != heif_error_Ok) return false;

// get width & height
width_ = heif_image_handle_get_width(heif_handle_);
height_ = heif_image_handle_get_height(heif_handle_);

// decode 
heif_image* heif_img_ = nullptr;
error = heif_decode_image(heif_handle_, &heif_img_, heif_colorspace_RGB, heif_chroma_interleaved_RGBA, nullptr);
if (error.code != heif_error_Ok) return false; 

// get data
int stride;
const uint8_t *data = heif_image_get_plane_readonly(heif_img_, heif_channel_interleaved, &stride);
if(data == nullptr) return false;

}

// release if (heifctx) { heif_context_free(heifctx); heifctx = nullptr; }

if (heifhandle) { heif_image_handle_release(heifhandle); helf_hanale = nuliptr:

if (heifimg) { heif_image_release(heifimg); helf1mg = nullptr; } `