diff --git a/Userland/Libraries/LibGfx/ImageFormats/TIFFLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/TIFFLoader.cpp index d8389986b1..6356d73738 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/TIFFLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/TIFFLoader.cpp @@ -622,4 +622,12 @@ ErrorOr> TIFFImageDecoderPlugin::icc_data() return m_context->metadata().icc_profile().map([](auto const& buffer) -> ReadonlyBytes { return buffer.bytes(); }); } +ErrorOr> TIFFImageDecoderPlugin::read_exif_metadata(ReadonlyBytes data) +{ + auto stream = TRY(try_make(data)); + auto plugin = TRY(adopt_nonnull_own_or_enomem(new (nothrow) TIFFImageDecoderPlugin(move(stream)))); + TRY(plugin->m_context->decode_image_header()); + return try_make(plugin->m_context->metadata()); +} + } diff --git a/Userland/Libraries/LibGfx/ImageFormats/TIFFLoader.h b/Userland/Libraries/LibGfx/ImageFormats/TIFFLoader.h index 59b4ee0f8e..02847a2e2b 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/TIFFLoader.h +++ b/Userland/Libraries/LibGfx/ImageFormats/TIFFLoader.h @@ -7,10 +7,13 @@ #pragma once #include +#include #include namespace Gfx { +class ExifMetadata; + // This is a link to the main TIFF specification from 1992 // https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf @@ -33,6 +36,7 @@ class TIFFImageDecoderPlugin : public ImageDecoderPlugin { public: static bool sniff(ReadonlyBytes); static ErrorOr> create(ReadonlyBytes); + static ErrorOr> read_exif_metadata(ReadonlyBytes); virtual ~TIFFImageDecoderPlugin() override = default;