JPEGWriter.h 566 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2023, Lucas Chollet <lucas.chollet@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Error.h>
  8. #include <LibGfx/Forward.h>
  9. namespace Gfx {
  10. struct JPEGEncoderOptions {
  11. Optional<ReadonlyBytes> icc_data;
  12. u8 quality { 75 };
  13. };
  14. class JPEGWriter {
  15. public:
  16. using Options = JPEGEncoderOptions;
  17. static ErrorOr<void> encode(Stream&, Bitmap const&, Options const& = {});
  18. static ErrorOr<void> encode(Stream&, CMYKBitmap const&, Options const& = {});
  19. private:
  20. JPEGWriter() = delete;
  21. };
  22. }