Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
imageio_jpeg.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2011, 2014 johannes hanika.
4 Copyright (C) 2012 Richard Wonka.
5 Copyright (C) 2012, 2014-2016 Tobias Ellinghaus.
6 Copyright (C) 2012 Ulrich Pegelow.
7 Copyright (C) 2016 Roman Lebedev.
8 Copyright (C) 2020 Pascal Obry.
9 Copyright (C) 2022 Martin Bařinka.
10 Copyright (C) 2025 Alynx Zhou.
11 Copyright (C) 2025 Aurélien PIERRE.
12
13 darktable is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 darktable is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with darktable. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27#ifndef DT_IMAGEIO_IMAGEIO_JPEG_H
28#define DT_IMAGEIO_IMAGEIO_JPEG_H
29
30#include <inttypes.h>
31#include <stdio.h>
32#include <stdlib.h>
33// this fixes a rather annoying, long time bug in libjpeg :(
34#undef HAVE_STDLIB_H
35#undef HAVE_STDDEF_H
36#include <jpeglib.h>
37#undef HAVE_STDLIB_H
38#undef HAVE_STDDEF_H
39
41#include "common/image.h"
42#include "caches/mipmap_cache.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48typedef struct dt_imageio_jpeg_t
49{
51 struct jpeg_source_mgr src;
52 struct jpeg_destination_mgr dest;
53 struct jpeg_decompress_struct dinfo;
54 struct jpeg_compress_struct cinfo;
55 FILE *f;
57
59int dt_imageio_jpeg_decompress_header(const void *in, size_t length, dt_imageio_jpeg_t *jpg);
64int dt_imageio_jpeg_compress(const uint8_t *in, uint8_t *out, const int width, const int height,
65 const int quality);
66
68int dt_imageio_jpeg_write(const char *filename, const uint8_t *in, const int width, const int height,
69 const int quality, const void *exif, int exif_len);
71int dt_imageio_jpeg_write_with_icc_profile(const char *filename, const uint8_t *in, const int width,
72 const int height, const int quality, const void *exif, int exif_len,
73 int32_t imgid);
75int dt_imageio_jpeg_read_header(const char *filename, dt_imageio_jpeg_t *jpg);
82
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif // DT_IMAGEIO_IMAGEIO_JPEG_H
91
92// clang-format off
93// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
94// vim: shiftwidth=2 expandtab tabstop=2 cindent
95// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
96// clang-format on
const dt_colormatrix_t dt_aligned_pixel_t out
dt_imageio_retval_t
Definition image.h:91
int dt_imageio_jpeg_write_with_icc_profile(const char *filename, const uint8_t *in, const int width, const int height, const int quality, const void *exif, int exif_len, int32_t imgid)
int dt_imageio_jpeg_read_profile(dt_imageio_jpeg_t *jpg, uint8_t **out)
int dt_imageio_jpeg_read(dt_imageio_jpeg_t *jpg, uint8_t *out)
int dt_imageio_jpeg_read_header(const char *filename, dt_imageio_jpeg_t *jpg)
dt_imageio_retval_t dt_imageio_open_jpeg(dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf)
dt_colorspaces_color_profile_type_t dt_imageio_jpeg_read_color_space(dt_imageio_jpeg_t *jpg)
int dt_imageio_jpeg_decompress_header(const void *in, size_t length, dt_imageio_jpeg_t *jpg)
int dt_imageio_jpeg_compress(const uint8_t *in, uint8_t *out, const int width, const int height, const int quality)
int dt_imageio_jpeg_decompress(dt_imageio_jpeg_t *jpg, uint8_t *out)
int dt_imageio_jpeg_write(const char *filename, const uint8_t *in, const int width, const int height, const int quality, const void *exif, int exif_len)
uint32_t width
Definition mipmap_cache.c:0
uint32_t height
Definition mipmap_cache.c:1
The colour-profile vocabulary, and nothing else.
dt_colorspaces_color_profile_type_t
struct jpeg_decompress_struct dinfo
Definition jpeg.c:74
struct jpeg_compress_struct cinfo
Definition jpeg.c:75
struct jpeg_source_mgr src
Definition jpeg.c:72
struct jpeg_destination_mgr dest
Definition jpeg.c:73