1 /* save.c - save image to file
3 * Raster graphics library
5 * Copyright (c) 1998-2003 Alfredo K. Kojima
6 * Copyright (c) 2013-2023 Window Maker Team
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
35 #include "imgformat.h"
38 Bool
RSaveImage(RImage
*image
, const char *filename
, const char *format
)
40 return RSaveTitledImage(image
, filename
, format
, NULL
);
43 Bool
RSaveTitledImage(RImage
*image
, const char *filename
, const char *format
, char *title
)
46 if (strcasecmp(format
, "PNG") == 0)
47 return RSavePNG(image
, filename
, title
);
50 if (strcasecmp(format
, "JPG") == 0)
51 return RSaveJPEG(image
, filename
, title
);
53 if (strcasecmp(format
, "JPEG") == 0)
54 return RSaveJPEG(image
, filename
, title
);
56 if (strcasecmp(format
, "XPM") == 0)
57 return RSaveXPM(image
, filename
);
59 RErrorCode
= RERR_BADFORMAT
;