Debian Codegraph @

libwebp_src/imageio/image_enc.h

raw symbols SCIP
1 // Copyright 2016 Google Inc. All Rights Reserved.
2 //
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 // -----------------------------------------------------------------------------
9 //
10 // All-in-one library to save PNG/JPEG/WebP/TIFF/WIC images.
11 //
12 // Author: Skal ([email protected])
13
14 #ifndef WEBP_IMAGEIO_IMAGE_ENC_H_
15 #define WEBP_IMAGEIO_IMAGE_ENC_H_
16
17 #include <stdio.h>
18
19 #ifdef HAVE_CONFIG_H
20 #include "webp/config.h"
21 #endif
22
23 #include "webp/types.h"
24 #include "webp/decode.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 // Output types
31 typedef enum {
32 PNG = 0,
33 PAM,
34 PPM,
35 PGM,
36 BMP,
37 TIFF,
38 RAW_YUV,
39 ALPHA_PLANE_ONLY, // this is for experimenting only
40 // forced colorspace output (for testing, mostly)
41 RGB, RGBA, BGR, BGRA, ARGB,
42 RGBA_4444, RGB_565,
43 rgbA, bgrA, Argb, rgbA_4444,
44 YUV, YUVA
45 } WebPOutputFileFormat;
46
47 // General all-purpose call.
48 // Most formats expect a 'buffer' containing RGBA-like samples, except
49 // RAW_YUV, YUV and YUVA formats.
50 // If 'out_file_name' is "-", data is saved to stdout.
51 // Returns false if an error occurred, true otherwise.
52 int WebPSaveImage(const WebPDecBuffer* const buffer,
53 WebPOutputFileFormat format, const char* const out_file_name);
54
55 // Save to PNG.
56 #ifdef HAVE_WINCODEC_H
57 int WebPWritePNG(const char* out_file_name, int use_stdout,
58 const struct WebPDecBuffer* const buffer);
59 #else
60 int WebPWritePNG(FILE* out_file, const WebPDecBuffer* const buffer);
61 #endif
62
63 // Save to PPM format (RGB, no alpha)
64 int WebPWritePPM(FILE* fout, const struct WebPDecBuffer* const buffer);
65
66 // Save to PAM format (= PPM + alpha)
67 int WebPWritePAM(FILE* fout, const struct WebPDecBuffer* const buffer);
68
69 // Save 16b mode (RGBA4444, RGB565, ...) for debugging purposes.
70 int WebPWrite16bAsPGM(FILE* fout, const struct WebPDecBuffer* const buffer);
71
72 // Save as BMP
73 int WebPWriteBMP(FILE* fout, const struct WebPDecBuffer* const buffer);
74
75 // Save as TIFF
76 int WebPWriteTIFF(FILE* fout, const struct WebPDecBuffer* const buffer);
77
78 // Save the ALPHA plane (only) as a PGM
79 int WebPWriteAlphaPlane(FILE* fout, const struct WebPDecBuffer* const buffer);
80
81 // Save as YUV samples as PGM format (using IMC4 layout).
82 // See: https://www.fourcc.org/yuv.php#IMC4.
83 // (very convenient format for viewing the samples, esp. for odd dimensions).
84 int WebPWritePGM(FILE* fout, const struct WebPDecBuffer* const buffer);
85
86 // Save YUV(A) planes sequentially (raw dump)
87 int WebPWriteYUV(FILE* fout, const struct WebPDecBuffer* const buffer);
88
89 // Save 16b mode (RGBA4444, RGB565, ...) as PGM format, for debugging purposes.
90 int WebPWrite16bAsPGM(FILE* fout, const struct WebPDecBuffer* const buffer);
91
92 #ifdef __cplusplus
93 } // extern "C"
94 #endif
95
96 #endif // WEBP_IMAGEIO_IMAGE_ENC_H_