1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
17 //-----------------------------------------------------------------------------
24 * Converts a true color image to a palette image, using Floyd-Steinberg dithering.
26 * For color matching, this function uses the Euclidean distance between colors in the
27 * YCbCr color space, which yields to better results than using sRGB directly.
29 * A comparison can be found at https://twitter.com/Socram4x8/status/1733157380097995205/photo/1.
31 gdImagePtr
img_palettize(gdImagePtr rgb
, int *palette
, int palette_size
);
34 * This function scales and crops the image to the given size.
35 * Think of "background-size: cover" in CSS.
37 gdImagePtr
img_crop_to_fit(gdImagePtr orig
, int width
, int height
);