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#pragma once
28
29#include <inttypes.h>
30#include <stdio.h>
31#include <stdlib.h>
32// this fixes a rather annoying, long time bug in libjpeg :(
33#undef HAVE_STDLIB_H
34#undef HAVE_STDDEF_H
35#include <jpeglib.h>
36#undef HAVE_STDLIB_H
37#undef HAVE_STDDEF_H
38
39#include "common/colorspaces.h"
40#include "common/image.h"
41#include "common/mipmap_cache.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47typedef struct dt_imageio_jpeg_t
48{
50 struct jpeg_source_mgr src;
51 struct jpeg_destination_mgr dest;
52 struct jpeg_decompress_struct dinfo;
53 struct jpeg_compress_struct cinfo;
54 FILE *f;
56
58int dt_imageio_jpeg_decompress_header(const void *in, size_t length, dt_imageio_jpeg_t *jpg);
63int dt_imageio_jpeg_compress(const uint8_t *in, uint8_t *out, const int width, const int height,
64 const int quality);
65
67int dt_imageio_jpeg_write(const char *filename, const uint8_t *in, const int width, const int height,
68 const int quality, const void *exif, int exif_len);
70int dt_imageio_jpeg_write_with_icc_profile(const char *filename, const uint8_t *in, const int width,
71 const int height, const int quality, const void *exif, int exif_len,
72 int32_t imgid);
74int dt_imageio_jpeg_read_header(const char *filename, dt_imageio_jpeg_t *jpg);
81
84
85#ifdef __cplusplus
86}
87#endif
88
89// clang-format off
90// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
91// vim: shiftwidth=2 expandtab tabstop=2 cindent
92// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
93// clang-format on
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
dt_colorspaces_color_profile_type_t
Definition colorspaces.h:81
static const dt_colormatrix_t dt_aligned_pixel_t out
Definition colorspaces_inline_conversions.h:184
dt_imageio_retval_t
Definition common/image.h:78
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)
Definition imageio_jpeg.c:511
int dt_imageio_jpeg_read_profile(dt_imageio_jpeg_t *jpg, uint8_t **out)
Definition imageio_jpeg.c:722
struct dt_imageio_jpeg_t dt_imageio_jpeg_t
int dt_imageio_jpeg_read(dt_imageio_jpeg_t *jpg, uint8_t *out)
Definition imageio_jpeg.c:652
int dt_imageio_jpeg_read_header(const char *filename, dt_imageio_jpeg_t *jpg)
Definition imageio_jpeg.c:581
dt_imageio_retval_t dt_imageio_open_jpeg(dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf)
Definition imageio_jpeg.c:742
dt_colorspaces_color_profile_type_t dt_imageio_jpeg_read_color_space(dt_imageio_jpeg_t *jpg)
Definition imageio_jpeg.c:731
int dt_imageio_jpeg_decompress_header(const void *in, size_t length, dt_imageio_jpeg_t *jpg)
Definition imageio_jpeg.c:136
int dt_imageio_jpeg_compress(const uint8_t *in, uint8_t *out, const int width, const int height, const int quality)
Definition imageio_jpeg.c:282
int dt_imageio_jpeg_decompress(dt_imageio_jpeg_t *jpg, uint8_t *out)
Definition imageio_jpeg.c:214
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)
Definition imageio_jpeg.c:575
Definition common/image.h:247
Definition imageio_jpeg.h:48
FILE * f
Definition imageio_jpeg.h:54
struct jpeg_decompress_struct dinfo
Definition imageio_jpeg.h:52
int height
Definition imageio_jpeg.h:49
struct jpeg_compress_struct cinfo
Definition imageio_jpeg.h:53
int width
Definition imageio_jpeg.h:49
struct jpeg_source_mgr src
Definition imageio_jpeg.h:50
struct jpeg_destination_mgr dest
Definition imageio_jpeg.h:51
Definition mipmap_cache.h:68