Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
imageio.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2022 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include "common/image.h"
23#include "common/mipmap_cache.h"
24#include "common/tags.h"
25#include <glib.h>
26#include <stdio.h>
27#include <inttypes.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#define FILTERS_ARE_CYGM(filters) \
34 ((filters) == 0xb4b4b4b4 || (filters) == 0x4b4b4b4b || (filters) == 0x1e1e1e1e || (filters) == 0xe1e1e1e1)
35
36#define FILTERS_ARE_RGBE(filters) \
37 ((filters) == 0x63636363 || (filters) == 0x36363636 || (filters) == 0x9c9c9c9c || (filters) == 0xc9c9c9c9)
38
39// FIXME: kill this pls.
40#define FILTERS_ARE_4BAYER(filters) (FILTERS_ARE_CYGM(filters) || FILTERS_ARE_RGBE(filters))
41
42// for Adobe coefficients from LibRaw & RawSpeed
43#define ADOBE_COEFF_FACTOR 10000
44
59
60// Checks that the image is indeed an ldr image
61gboolean dt_imageio_is_ldr(const char *filename);
62// checks that the image has a monochrome preview attached
63gboolean dt_imageio_has_mono_preview(const char *filename);
64// Set the ansel/mode/hdr tag
66// Update the tag for b&w workflow
67void dt_imageio_update_monochrome_workflow_tag(int32_t id, int mask);
68// opens the file using pfm, hdr, exr.
70// opens file using imagemagick
72// try all the options in sequence
74// tries to open the files not opened by the other routines using GraphicsMagick (if supported)
77
80int dt_imageio_export(const int32_t imgid, const char *filename, struct dt_imageio_module_format_t *format,
81 struct dt_imageio_module_data_t *format_params, const gboolean high_quality,
82 const gboolean copy_metadata, const gboolean export_masks,
83 dt_colorspaces_color_profile_type_t icc_type, const gchar *icc_filename,
85 dt_imageio_module_data_t *storage_params, int num, int total, dt_export_metadata_t *metadata);
86
87int dt_imageio_export_with_flags(const int32_t imgid, const char *filename,
88 struct dt_imageio_module_format_t *format,
89 struct dt_imageio_module_data_t *format_params, const gboolean ignore_exif,
90 const gboolean display_byteorder, const gboolean high_quality, gboolean is_scaling,
91 const gboolean thumbnail_export, const char *filter, const gboolean copy_metadata,
92 const gboolean export_masks, dt_colorspaces_color_profile_type_t icc_type,
93 const gchar *icc_filename, dt_iop_color_intent_t icc_intent,
95 int num, int total, dt_export_metadata_t *metadata);
96
97// general, efficient buffer flipping function using memcopies
98void dt_imageio_flip_buffers(char *out, const char *in,
99 const size_t bpp, // bytes per pixel
100 const int wd, const int ht, const int fwd, const int fht, const int stride,
101 const dt_image_orientation_t orientation);
102
103void dt_imageio_flip_buffers_ui8_to_float(float *out, const uint8_t *in, const float black, const float white,
104 const int ch, const int wd, const int ht, const int fwd,
105 const int fht, const int stride,
106 const dt_image_orientation_t orientation);
107
121int dt_imageio_large_thumbnail(const char *filename, uint8_t **buffer, int32_t *th_width, int32_t *th_height,
123 const int height);
124
125// lookup maker and model, dispatch lookup to rawspeed or libraw
126gboolean dt_imageio_lookup_makermodel(const char *maker, const char *model,
127 char *mk, int mk_len, char *md, int md_len,
128 char *al, int al_len);
129
130// get the type of image from its extension
132
133#ifdef __cplusplus
134}
135#endif
136
137// clang-format off
138// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
139// vim: shiftwidth=2 expandtab tabstop=2 cindent
140// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
141// clang-format on
const char * extension(dt_imageio_module_data_t *data)
Definition avif.c:695
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
dt_iop_color_intent_t
Definition colorspaces.h:43
dt_colorspaces_color_profile_type_t
Definition colorspaces.h:61
dt_image_orientation_t
Definition common/image.h:123
dt_imageio_retval_t
Definition common/image.h:37
dt_image_flags_t
Definition common/image.h:45
int bpp
Definition imageio/format/pdf.c:76
void dt_imageio_set_hdr_tag(dt_image_t *img)
Definition imageio.c:1276
gboolean dt_imageio_is_ldr(const char *filename)
void dt_imageio_flip_buffers_ui8_to_float(float *out, const uint8_t *in, const float black, const float white, const int ch, const int wd, const int ht, const int fwd, const int fht, const int stride, const dt_image_orientation_t orientation)
Definition imageio.c:358
int dt_imageio_export_with_flags(const int32_t imgid, const char *filename, struct dt_imageio_module_format_t *format, struct dt_imageio_module_data_t *format_params, const gboolean ignore_exif, const gboolean display_byteorder, const gboolean high_quality, gboolean is_scaling, const gboolean thumbnail_export, const char *filter, const gboolean copy_metadata, const gboolean export_masks, dt_colorspaces_color_profile_type_t icc_type, const gchar *icc_filename, dt_iop_color_intent_t icc_intent, dt_imageio_module_storage_t *storage, dt_imageio_module_data_t *storage_params, int num, int total, dt_export_metadata_t *metadata)
Definition imageio.c:994
gboolean dt_imageio_lookup_makermodel(const char *maker, const char *model, char *mk, int mk_len, char *md, int md_len, char *al, int al_len)
Definition imageio.c:1372
dt_imageio_retval_t dt_imageio_open(dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf)
Definition imageio.c:1291
void dt_imageio_update_monochrome_workflow_tag(int32_t id, int mask)
Definition imageio.c:1260
dt_imageio_retval_t dt_imageio_open_raster(dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf)
Definition imageio.c:585
gboolean dt_imageio_has_mono_preview(const char *filename)
Definition imageio.c:274
dt_imageio_levels_t
Definition imageio.h:46
@ IMAGEIO_INT32
Definition imageio.h:50
@ IMAGEIO_INT16
Definition imageio.h:49
@ IMAGEIO_PREC_MASK
Definition imageio.h:53
@ IMAGEIO_RGB
Definition imageio.h:55
@ IMAGEIO_INT12
Definition imageio.h:48
@ IMAGEIO_INT8
Definition imageio.h:47
@ IMAGEIO_CHANNEL_MASK
Definition imageio.h:57
@ IMAGEIO_GRAY
Definition imageio.h:56
@ IMAGEIO_FLOAT
Definition imageio.h:51
@ IMAGEIO_BW
Definition imageio.h:52
void dt_imageio_flip_buffers(char *out, const char *in, const size_t bpp, const int wd, const int ht, const int fwd, const int fht, const int stride, const dt_image_orientation_t orientation)
Definition imageio.c:307
dt_imageio_retval_t dt_imageio_open_hdr(dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf)
Definition imageio.c:414
dt_imageio_retval_t dt_imageio_open_exotic(dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf)
Definition imageio.c:1240
dt_image_flags_t dt_imageio_get_type_from_extension(const char *extension)
Definition imageio.c:97
int dt_imageio_export(const int32_t imgid, const char *filename, struct dt_imageio_module_format_t *format, struct dt_imageio_module_data_t *format_params, const gboolean high_quality, const gboolean copy_metadata, const gboolean export_masks, dt_colorspaces_color_profile_type_t icc_type, const gchar *icc_filename, dt_iop_color_intent_t icc_intent, dt_imageio_module_storage_t *storage, dt_imageio_module_data_t *storage_params, int num, int total, dt_export_metadata_t *metadata)
Definition imageio.c:686
int dt_imageio_large_thumbnail(const char *filename, uint8_t **buffer, int32_t *th_width, int32_t *th_height, dt_colorspaces_color_profile_type_t *color_space, const int width, const int height)
Load the thumbnail embedded into a RAW file having at least the size MAX(width, height) x MAX(width,...
Definition imageio.c:125
const char * maker
Definition iop/tonecurve.c:493
const char * model
Definition iop/tonecurve.c:494
dt_colorspaces_color_profile_type_t color_space
Definition mipmap_cache.c:5
Definition metadata_export.h:35
Definition common/image.h:195
Definition imageio_module.h:62
Definition imageio_module.h:72
Definition imageio_module.h:94
Definition mipmap_cache.h:58