sng-devel Mailing List for The SNG Project
Textualize a PNG image, or turn a textualized image back to a PNG.
Brought to you by:
esr
You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Eric R. <es...@th...> - 2011-06-15 22:00:49
|
James Cloos <cl...@jh...>: > Based on the git repo, the last change to PNG_LIBPNG_VER_MINOR before > these changes was from 1.2.10 to 1.4.0. There is no 1.3. > > Therefore, your proposed patch in the other reply looks correct. That's good. > There are still a bunch of api deprecation warnings, and I get the notice: > > 0 sBIT red bits not valid for 8bit/sample image > > from almost every png I try. Converting such a .sng back to png gives > the related warning: > > libpng warning: Invalid sBIT depth specified > > So there may be more api changes which affect sng but do not prevent > compilation.... Yuck. Does an sng copy built with 1.4 pass the regression tests? -- <a href="http://www.catb.org/~esr/">Eric S. Raymond</a> |
From: James C. <cl...@jh...> - 2011-06-15 20:56:06
|
> ...this clearly relates to a libpng API change, and we need to figure > out when it happened to conditionalize the code properly. Indeed. That is why I left it as a simple git diff and not git format-patch output. I looked at the libpng git repo. Change "trans" to "trans_alpha" is commit 6abea7562b which is after the bump to 1.4.0beta74 and before the bump to 1.4.0beta75. The change from trans_values to trans_color occurred in commit 56f6396137, which is 'Imported from libpng-1.4.0beta35.tar', from before the switch to git. Based on the git repo, the last change to PNG_LIBPNG_VER_MINOR before these changes was from 1.2.10 to 1.4.0. There is no 1.3. Therefore, your proposed patch in the other reply looks correct. There are still a bunch of api deprecation warnings, and I get the notice: 0 sBIT red bits not valid for 8bit/sample image from almost every png I try. Converting such a .sng back to png gives the related warning: libpng warning: Invalid sBIT depth specified So there may be more api changes which affect sng but do not prevent compilation.... -JimC -- James Cloos <cl...@jh...> OpenPGP: 1024D/ED7DAEA6 |
From: Eric R. <es...@th...> - 2011-06-15 19:29:15
|
Here's my first cut at coping with the API problem. Compiles here. diff --git a/sngd.c b/sngd.c index 248ac97..1ab5727 100644 --- a/sngd.c +++ b/sngd.c @@ -12,6 +12,21 @@ NAME #include "png.h" #include "sng.h" +/* cope with API issues */ +#if PNG_LIBPNG_VER_MAJOR == 1 + #if PNG_LIBPNG_VER_MINOR <= 2 + #define TRANS_COLOR trans_values + #define TRANS_ALPHA trans + #endif + #if PNG_LIBPNG_VER_MINOR == 3 + #error Not yet ported to 1.3 + #endif + #if PNG_LIBPNG_VER_MINOR >= 4 + #define TRANS_COLOR trans_color + #define TRANS_ALPHA trans_alpha + #endif +#endif + png_structp png_ptr; png_infop info_ptr; @@ -794,17 +809,17 @@ static void dump_tRNS(FILE *fpout) fprintf(fpout, "tRNS {\n"); switch (info_ptr->color_type) { case PNG_COLOR_TYPE_GRAY: - fprintf(fpout, " gray: %u;\n", info_ptr->trans_values.gray); + fprintf(fpout, " gray: %u;\n", info_ptr->TRANS_COLOR.gray); break; case PNG_COLOR_TYPE_RGB: fprintf(fpout, " red: %u; green: %u; blue: %u;\n", - info_ptr->trans_values.red, - info_ptr->trans_values.green, - info_ptr->trans_values.blue); + info_ptr->TRANS_COLOR.red, + info_ptr->TRANS_COLOR.green, + info_ptr->TRANS_COLOR.blue); break; case PNG_COLOR_TYPE_PALETTE: for (i = 0; i < info_ptr->num_trans; i++) - fprintf(fpout, " %u", info_ptr->trans[i]); + fprintf(fpout, " %u", info_ptr->TRANS_ALPHA[i]); break; case PNG_COLOR_TYPE_GRAY_ALPHA: case PNG_COLOR_TYPE_RGB_ALPHA: -- <a href="http://www.catb.org/~esr/">Eric S. Raymond</a> |
From: Eric R. <es...@th...> - 2011-06-15 19:13:30
|
James Cloos <cl...@jh...>: > I tried to compile sng from git. I have libpng-1.4.7 installed. > > First, notwithstanding the recent commits, I had to pass > > --with-rgbtxt=/usr/share/X11/rgb.txt > > to get ./configure to complete. > > That is fixed by: > > diff --git a/configure.in b/configure.in > index b78df01..5dd6c4e 100644 > --- a/configure.in > +++ b/configure.in > @@ -44,7 +44,7 @@ if test -n "$with_rgbtxt" > then > AC_DEFINE_UNQUOTED(RGBTXT, "$with_rgbtxt", [Location of X color database]) > else > - for dir in /etc/X11/ /usr/share/X11/rgb.txt /usr/X11R6/lib/X11 /usr/lib/X11 /usr/openwin/lib > + for dir in /etc/X11/ /usr/share/X11/ /usr/X11R6/lib/X11 /usr/lib/X11 /usr/openwin/lib > do > if test -f ${dir}/rgb.txt > then That change is clearly correct. Taken. On the other hand... > Second, sngd.c fails to compile with 166 deprication warnings (52 unique) > and these errors: > > :; gcc -DHAVE_CONFIG_H -I. -g -MT sngd.o -MD -MP -MF .deps/sngd.Tpo -c -o sngd.o sngd.c 2>&1 |egrep -i error > sngd.c:797:48: error: ‘png_info’ has no member named ‘trans_values’ > sngd.c:801:15: error: ‘png_info’ has no member named ‘trans_values’ > sngd.c:802:15: error: ‘png_info’ has no member named ‘trans_values’ > sngd.c:803:15: error: ‘png_info’ has no member named ‘trans_values’ > sngd.c:807:33: error: ‘png_info’ has no member named ‘trans’ > > After reading libpng(3), I see that this patch is required: > > diff --git a/sngd.c b/sngd.c > index 248ac97..888d214 100644 > --- a/sngd.c > +++ b/sngd.c > @@ -794,17 +794,17 @@ static void dump_tRNS(FILE *fpout) > fprintf(fpout, "tRNS {\n"); > switch (info_ptr->color_type) { > case PNG_COLOR_TYPE_GRAY: > - fprintf(fpout, " gray: %u;\n", info_ptr->trans_values.gray); > + fprintf(fpout, " gray: %u;\n", info_ptr->trans_color.gray); > break; > case PNG_COLOR_TYPE_RGB: > fprintf(fpout, " red: %u; green: %u; blue: %u;\n", > - info_ptr->trans_values.red, > - info_ptr->trans_values.green, > - info_ptr->trans_values.blue); > + info_ptr->trans_color.red, > + info_ptr->trans_color.green, > + info_ptr->trans_color.blue); > break; > case PNG_COLOR_TYPE_PALETTE: > for (i = 0; i < info_ptr->num_trans; i++) > - fprintf(fpout, " %u", info_ptr->trans[i]); > + fprintf(fpout, " %u", info_ptr->trans_alpha[i]); > break; > case PNG_COLOR_TYPE_GRAY_ALPHA: > case PNG_COLOR_TYPE_RGB_ALPHA: ...this clearly relates to a libpng API change, and we need to figure out when it happened to conditionalize the code properly. Here's what I see in my png.h: #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 2 #define PNG_LIBPNG_VER_RELEASE 42 What do those constants look like for you? And does the libpng Changelog tell you when the the API break was? What I'm thinking is that I should define TRANS_ALPHA and TRANS_COLOR macros that are conditionally defined by version. -- <a href="http://www.catb.org/~esr/">Eric S. Raymond</a> |
From: James C. <cl...@jh...> - 2011-06-14 07:06:13
|
I tried to compile sng from git. I have libpng-1.4.7 installed. First, notwithstanding the recent commits, I had to pass --with-rgbtxt=/usr/share/X11/rgb.txt to get ./configure to complete. That is fixed by: diff --git a/configure.in b/configure.in index b78df01..5dd6c4e 100644 --- a/configure.in +++ b/configure.in @@ -44,7 +44,7 @@ if test -n "$with_rgbtxt" then AC_DEFINE_UNQUOTED(RGBTXT, "$with_rgbtxt", [Location of X color database]) else - for dir in /etc/X11/ /usr/share/X11/rgb.txt /usr/X11R6/lib/X11 /usr/lib/X11 /usr/openwin/lib + for dir in /etc/X11/ /usr/share/X11/ /usr/X11R6/lib/X11 /usr/lib/X11 /usr/openwin/lib do if test -f ${dir}/rgb.txt then Second, sngd.c fails to compile with 166 deprication warnings (52 unique) and these errors: :; gcc -DHAVE_CONFIG_H -I. -g -MT sngd.o -MD -MP -MF .deps/sngd.Tpo -c -o sngd.o sngd.c 2>&1 |egrep -i error sngd.c:797:48: error: ‘png_info’ has no member named ‘trans_values’ sngd.c:801:15: error: ‘png_info’ has no member named ‘trans_values’ sngd.c:802:15: error: ‘png_info’ has no member named ‘trans_values’ sngd.c:803:15: error: ‘png_info’ has no member named ‘trans_values’ sngd.c:807:33: error: ‘png_info’ has no member named ‘trans’ After reading libpng(3), I see that this patch is required: diff --git a/sngd.c b/sngd.c index 248ac97..888d214 100644 --- a/sngd.c +++ b/sngd.c @@ -794,17 +794,17 @@ static void dump_tRNS(FILE *fpout) fprintf(fpout, "tRNS {\n"); switch (info_ptr->color_type) { case PNG_COLOR_TYPE_GRAY: - fprintf(fpout, " gray: %u;\n", info_ptr->trans_values.gray); + fprintf(fpout, " gray: %u;\n", info_ptr->trans_color.gray); break; case PNG_COLOR_TYPE_RGB: fprintf(fpout, " red: %u; green: %u; blue: %u;\n", - info_ptr->trans_values.red, - info_ptr->trans_values.green, - info_ptr->trans_values.blue); + info_ptr->trans_color.red, + info_ptr->trans_color.green, + info_ptr->trans_color.blue); break; case PNG_COLOR_TYPE_PALETTE: for (i = 0; i < info_ptr->num_trans; i++) - fprintf(fpout, " %u", info_ptr->trans[i]); + fprintf(fpout, " %u", info_ptr->trans_alpha[i]); break; case PNG_COLOR_TYPE_GRAY_ALPHA: case PNG_COLOR_TYPE_RGB_ALPHA: -JimC -- James Cloos <cl...@jh...> OpenPGP: 1024D/ED7DAEA6 |