This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository legacy-imlib2.
View the commit online.
commit 00dcf6851fa85298b70f49ad9dc876651ccc8413
Author: Kim Woelders <[email protected]>
AuthorDate: Sun Jan 22 09:45:18 2023 +0100
PNM saver: Write images with alpha as P7 PAM RGB_ALPHA type
The previously used P8 type seems to be known only by imlib2.
---
src/modules/loaders/loader_pnm.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/modules/loaders/loader_pnm.c b/src/modules/loaders/loader_pnm.c
index f887d1e..2f8b937 100644
--- a/src/modules/loaders/loader_pnm.c
+++ b/src/modules/loaders/loader_pnm.c
@@ -593,6 +593,24 @@ _load(ImlibImage * im, int load_data)
return rc;
}
+/**INDENT-OFF**/
+static const char fmt_rgb[] =
+ "P6\n"
+ "# PNM File written by Imlib2\n"
+ "%i %i\n"
+ "255\n";
+
+static const char fmt_rgba[] =
+ "P7\n"
+ "# PAM File written by Imlib2\n"
+ "WIDTH %d\n"
+ "HEIGHT %d\n"
+ "DEPTH 4\n"
+ "MAXVAL 255\n"
+ "TUPLTYPE RGB_ALPHA\n"
+ "ENDHDR\n";
+/**INDENT-ON**/
+
static int
_save(ImlibImage * im)
{
@@ -618,8 +636,7 @@ _save(ImlibImage * im)
/* if the image has a useful alpha channel */
if (im->has_alpha)
{
- fprintf(f, "P8\n" "# PNM File written by Imlib2\n" "%i %i\n" "255\n",
- im->w, im->h);
+ fprintf(f, fmt_rgba, im->w, im->h);
for (y = 0; y < im->h; y++)
{
bptr = buf;
@@ -641,8 +658,7 @@ _save(ImlibImage * im)
}
else
{
- fprintf(f, "P6\n" "# PNM File written by Imlib2\n" "%i %i\n" "255\n",
- im->w, im->h);
+ fprintf(f, fmt_rgb, im->w, im->h);
for (y = 0; y < im->h; y++)
{
bptr = buf;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.