]> bicyclesonthemoon.info Git - ott/enhance/commitdiff
palette tools online
authorb <rowerynaksiezycu@gmail.com>
Mon, 5 Dec 2022 22:28:34 +0000 (22:28 +0000)
committerb <rowerynaksiezycu@gmail.com>
Mon, 5 Dec 2022 22:28:34 +0000 (22:28 +0000)
14 files changed:
bluenh-cgi.c
diff-cgi.c
enhance-bottom.htm
enhance.1.conf
makefile
makefile.1.mak
nofading-cgi.c
npb-cgi.c
online-core.1.h
pal-cgi.c
pal.1.htm
reveal-cgi.c
settings-release.txt
settings.txt

index b55cc8a1fcde5d8312e96f443fd9bd97e9ddabd6..68d031b22742a00cce06964c8c8fd783f05e84a3 100644 (file)
@@ -114,8 +114,6 @@ int main (int argc, char *argv[])
        }
        r2 = rm(in_tmp);
        r3 = rm(out_tmp);
-       if (r)
-               return r;
        if (r1)
                return r1;
        if (r2)
index 27a3267405327461303736980da2230cebe8d02b..90decf0633c155000ccd4a351ed3e0319a0c56a1 100644 (file)
@@ -132,8 +132,6 @@ int main (int argc, char *argv[])
        r2 = rm(in0_tmp);
        r3 = rm(in1_tmp);
        r4 = rm(out_tmp);
-       if (r)
-               return r;
        if (r1)
                return r1;
        if (r2)
index 9fca8156625519a22ab721154fc7cef190e0fff3..8055a00f4e5a0df752f322cc79994601df710f81 100644 (file)
@@ -1,5 +1,7 @@
                <br>
                Source code available at <a href="http://bicyclesonthemoon.info/git-projects/?p=ott/enhance">http://bicyclesonthemoon.info/git-projects/?p=ott/enhance</a>.<br>
                Licensed under <a href="/a/agpl.txt">AGPL 3</a>.
+               <br><br>
+               <a href="/">1190.bicyclesonthemoon.info</a>
        </body>
 </html>
index 58eff1020704778d80de95eb51c9e851d7cf434b..58a2c9ca9b7a59824361e6386324d0db592cd95f 100644 (file)
@@ -4,6 +4,7 @@ ScriptAlias /enhance/bluenh   ###CONF_bluenh;
 ScriptAlias /enhance/diff     ###CONF_diff;
 ScriptAlias /enhance/nofading ###CONF_nofading;
 ScriptAlias /enhance/npb      ###CONF_npb;
+ScriptAlias /enhance/pal      ###CONF_pal;
 ScriptAlias /enhance/reveal   ###CONF_reveal;
 
 <Directory ###CONF_bin;>
index 8ae88dc3b7cab1dca3c80c8b14b04483ab2794ef..cc4fa8954ab94860d255b4f37b084cfbf4d0bb5a 100644 (file)
--- a/makefile
+++ b/makefile
@@ -110,28 +110,32 @@ nf.h\
 rvl.h\
 df.h\
 mpb.h\
-mpb_503.h
+mpb_503.h\
+nclr.h
 
 CGI=\
 bluenh-cgi\
 nofading-cgi\
 reveal-cgi\
 diff-cgi\
-npb-cgi
+npb-cgi\
+pal-cgi
 
 HTM_CGI=\
 bluenh.htm\
 nofading.htm\
 reveal.htm\
 diff.htm\
-npb.htm
+npb.htm\
+pal.htm
 
 HTM_CGI_1=\
 bluenh.1.htm\
 nofading.1.htm\
 reveal.1.htm\
 diff.1.htm\
-npb.1.htm
+npb.1.htm\
+pal.1.htm
 
 # keep these 2 lists in the same order!:
 GENERATE_FROM=\
index 0736b7a935661bcf688b0c192d1aac9c707a7a8e..6ebb2c7f8ab72c2dce9d5fd4fb597cba7687c666 100644 (file)
@@ -110,28 +110,32 @@ nf.h\
 rvl.h\
 df.h\
 mpb.h\
-mpb_503.h
+mpb_503.h\
+nclr.h
 
 CGI=\
 bluenh-cgi\
 nofading-cgi\
 reveal-cgi\
 diff-cgi\
-npb-cgi
+npb-cgi\
+pal-cgi
 
 HTM_CGI=\
 bluenh.htm\
 nofading.htm\
 reveal.htm\
 diff.htm\
-npb.htm
+npb.htm\
+pal.htm
 
 HTM_CGI_1=\
 bluenh.1.htm\
 nofading.1.htm\
 reveal.1.htm\
 diff.1.htm\
-npb.1.htm
+npb.1.htm\
+pal.1.htm
 
 # keep these 2 lists in the same order!:
 GENERATE_FROM=\
index 1c3c410452bc4923ad690d8c6f1278768ca0ec9f..f6f348372cd762f583fef89a1df6c31e847ecb99 100644 (file)
@@ -1,7 +1,7 @@
 /*
 nofading-cgi.c
 The online interface for the fading enhancement tool
-04.12.2022
+05.12.2022
 
 Copyright (C) 2015, 2022  Balthasar Szczepański
 
@@ -92,8 +92,6 @@ int main (int argc, char *argv[])
        }
        r2 = rm(in_tmp);
        r3 = rm(out_tmp);
-       if (r)
-               return r;
        if (r1)
                return r1;
        if (r2)
index 27049dd425df6d29e236372b58cd3b16e7317b24..855d85dec897e26c83bbc1d5c2bc75ccd6e6c7f4 100644 (file)
--- a/npb-cgi.c
+++ b/npb-cgi.c
@@ -129,8 +129,6 @@ int main (int argc, char *argv[])
        }
        r2 = rm(in_tmp);
        r3 = rm(out_tmp);
-       if (r)
-               return r;
        if (r1)
                return r1;
        if (r2)
index 46e935bdd090c326497fac79396aad23c4b9a2d8..73424078b3cf31c54fb23184da0f910aa62500d9 100644 (file)
@@ -32,11 +32,14 @@ Requires cgilib (http://www.infodrom.org/projects/cgilib/)
 
 // ###C_TEMP_PATH: #define TEMP_PATH "/botm/tmp/enhance"
 
-// ###C_BLUENH_PATH:   #define NPB_PATH      "/botm/bin/bluenh"
-// ###C_DIFF_PATH:     #define DIFF_PATH     "/botm/bin/diff"
-// ###C_NOFADING_PATH: #define NOFADING_PATH "/botm/bin/nofading"
-// ###C_NPB_PATH:      #define NPB_PATH      "/botm/bin/npb"
-// ###C_REVEAL_PATH:   #define REVEAL_PATH   "/botm/bin/reveal"
+// ###C_BLUENH_PATH:      #define NPB_PATH         "/botm/bin/bluenh"
+// ###C_DIFF_PATH:        #define DIFF_PATH        "/botm/bin/diff"
+// ###C_NOFADING_PATH:    #define NOFADING_PATH    "/botm/bin/nofading"
+// ###C_NPB_PATH:         #define NPB_PATH         "/botm/bin/npb"
+// ###C_PAL_MIX_PATH:     #define PAL_MIX_PATH     "/botm/bin/pal_mix"
+// ###C_PAL_MIXDIFF_PATH: #define PAL_MIXDIFF_PATH "/botm/bin/pal_mixdiff"
+// ###C_PAL_UNMIX_PATH:   #define PAL_UNMIX_PATH   "/botm/bin/pal_unmix"
+// ###C_REVEAL_PATH:      #define REVEAL_PATH      "/botm/bin/reveal"
 
 int cp (char *src, char *dst);
 int wget (char *url, char *dst);
index 0ffe0dcd5aadd8ccf26870d268730c2166cb2df0..0e7e4013a355ed0e45077998374118e06ccee177 100644 (file)
--- a/pal-cgi.c
+++ b/pal-cgi.c
-// insertframe.c\r
-// The online interface for the tools to insert and extract indexed images\r
-// 25.06.2015\r
-// \r
-// Copyright (C) 2015  Balthasar Szczepański\r
-// \r
-// This program is free software: you can redistribute it and/or modify\r
-// it under the terms of the GNU Affero General Public License as\r
-// published by the Free Software Foundation, either version 3 of the\r
-// License, or (at your option) any later version.\r
-// \r
-// This program is distributed in the hope that it will be useful,\r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-// GNU Affero General Public License for more details.\r
-// \r
-// You should have received a copy of the GNU Affero General Public License\r
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
-// \r
+/*\r
+pal-cgi.c\r
+The online interface for the tools to insert and extract indexed images\r
+05.12.2022\r
 \r
-// Requires cgilib (http://www.infodrom.org/projects/cgilib/)\r
-        \r
-#include <cgi.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <unistd.h>\r
-#include <string.h>\r
-#include <sys/wait.h>\r
-#include <sys/stat.h>\r
+Copyright (C) 2015, 2022  Balthasar Szczepański\r
 \r
-#define WGET_PATH  "/usr/bin/wget"\r
-#define INS_PATH   "./insert"\r
-#define EXT_PATH   "./extract"\r
-#define DIF_PATH   "./seediff"\r
+This program is free software: you can redistribute it and/or modify\r
+it under the terms of the GNU Affero General Public License as\r
+published by the Free Software Foundation, either version 3 of the\r
+License, or (at your option) any later version.\r
 \r
-#define RM_PATH    "/bin/rm"\r
-#define LOG_PATH   "/eizm/log/insertframe/insertframe.log"\r
-#define USERAGENT  "Hidden frames. (1190.bicyclesonthemoon.dnsd.info/insertframe/insertframe.htm)"\r
-#define MSTD_PATH  "/pro/insertframe/nclr.png"\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+GNU Affero General Public License for more details.\r
 \r
-int main (int argc, char *argv[]);\r
-void mustard(int mustard);\r
+You should have received a copy of the GNU Affero General Public License\r
+along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
 \r
-FILE *pix;\r
-unsigned short act;\r
+Requires cgilib (http://www.infodrom.org/projects/cgilib/)\r
+*/\r
 \r
+#include <stdio.h>\r
+#include <stdint.h>\r
+#include <unistd.h>\r
+#include <stdlib.h>\r
+#include <sys/wait.h>\r
+#include <stdint.h>\r
+#include <inttypes.h>\r
+\r
+#include <cgi.h>\r
+\r
+#include "online-core.h"\r
+#include "nclr.h"\r
 \r
-char url0[1024];\r
-char path0[256];\r
-char url1[1024];\r
-char path1[256];\r
-s_cgi *cgi;\r
-int t;\r
-pid_t sub;\r
+#define INSERT     0\r
+#define EXTRACT_H  1\r
+#define EXTRACT_V  2\r
+#define DETECT     3\r
+#define MAX_ACTION DETECT\r
 \r
+int insert(\r
+       char *inpix0, char *inpix1, char *outpix,\r
+       uint_fast8_t r0, uint_fast8_t r1\r
+);\r
+int extract(\r
+       char *inpix, char *outpix0, char *outpix1,\r
+       uint_fast8_t size_defined,\r
+       uint_fast8_t p0, uint_fast8_t p1\r
+);\r
+int detect(\r
+       char *inpix, char *outpix,\r
+       uint_fast8_t size_defined,\r
+       uint_fast8_t p0, uint_fast8_t p1\r
+);\r
 \r
 int main (int argc, char *argv[])\r
 {\r
-       unsigned char buf[1024];\r
-       struct stat st;\r
-       unsigned long p, i;\r
-       unsigned short q;\r
-       char **up;\r
+       s_cgi *cgi;\r
+       char tmp0[256];\r
+       char tmp1[256];\r
+       char tmp2[256];\r
+       char *in0_path;\r
+       char *in1_path;\r
        \r
-       // unsigned short r0, r1;\r
-       unsigned char n0=0;\r
-       unsigned char n1=0;\r
-\r
-       cgi=cgiInit();\r
+       char *t;\r
+       uint_fast8_t p0, p1;\r
+       uint_fast8_t size_defined = 0;\r
+       uint_fast8_t action;\r
        \r
-       sprintf(path0,"%s",(cgiGetValue(cgi,"a")!=NULL)?(cgiGetValue(cgi,"a")):"0");\r
-       act=atoi(path0);\r
-       // sprintf(path0,"%s",(cgiGetValue(cgi,"r0")!=NULL)?(cgiGetValue(cgi,"r0")):"1");\r
-       // r0=atoi(path0);\r
-       // sprintf(path0,"%s",(cgiGetValue(cgi,"r1")!=NULL)?(cgiGetValue(cgi,"r1")):"0");\r
-       // r1=atoi(path0);\r
-\r
-       up=cgiGetFiles(cgi);\r
-       if (up)\r
-       {\r
-               if (cgiGetFile(cgi,up[0])!=NULL)\r
-               {\r
-                       sprintf(path0,"%s",cgiGetFile(cgi,up[0])->tmpfile);\r
-                       sprintf(url0,"%s",cgiGetFile(cgi,up[0])->filename);\r
-                       n0=1;\r
-               }\r
-               if (cgiGetFile(cgi,up[1])!=NULL)\r
-               {\r
-                       sprintf(path1,"%s",cgiGetFile(cgi,up[1])->tmpfile);\r
-                       sprintf(url1,"%s",cgiGetFile(cgi,up[1])->filename);\r
-                       n1=1;\r
-               }\r
-       }\r
+       int r=0;\r
+       int r1=0;\r
+       int r2=0;\r
+       int r3=0;\r
+       int r4=0;\r
        \r
-       if(!n0)\r
-       {\r
-               sprintf(url0,"%s",(cgiGetValue(cgi,"inpix0")!=NULL)?(cgiGetValue(cgi,"inpix0")):"");\r
-               sprintf(path0,"/var/tmp/%lu_0",(unsigned long)getpid());\r
+       do {\r
+               make_tmp_path(tmp0, 256, 0, ".png");\r
+               make_tmp_path(tmp1, 256, 1, ".png");\r
+               make_tmp_path(tmp2, 256, 2, ".png");\r
+               \r
+               cgi=cgiInit();\r
+               \r
+               t = cgiGetValue(cgi, "a");\r
+               if (t != NULL)\r
+                       sscanf(t,"%"SCNuFAST8, &action);\r
+               else\r
+                       action = DETECT;\r
+               if (action > MAX_ACTION)\r
+                       action = DETECT;\r
                \r
-               sub=fork();\r
-               if(sub==0)\r
+               r = get_file(cgi,"inpixf0", tmp0, &in0_path);\r
+               if (r)\r
+                       r = get_file(cgi,"inpix0", tmp0, &in0_path);\r
+               if (r)\r
+                       break;\r
+               \r
+               if (action == INSERT)\r
                {\r
-                       t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",USERAGENT,"-O",path0,url0,(char *)0);\r
-                       exit(t);\r
+                       r = get_file(cgi,"inpixf1", tmp1, &in1_path);\r
+                       if (r)\r
+                               r = get_file(cgi,"inpix1", tmp1, &in1_path);\r
+                       if (r)\r
+                               break;\r
+                       \r
+                       t = cgiGetValue(cgi, "r0");\r
+                       if (t != NULL)\r
+                               sscanf(t,"%"SCNuFAST8, &p0);\r
+                       else\r
+                               p0 = 1;\r
+                       \r
+                       t = cgiGetValue(cgi, "r1");\r
+                       if (t != NULL)\r
+                               sscanf(t,"%"SCNuFAST8, &p1);\r
+                       else\r
+                               p1 = 0;\r
                }\r
-               waitpid(sub,&t,0);\r
-               if(t)mustard(t);\r
-       }\r
-       \r
-       if(!n1)\r
-       {\r
-               sprintf(url1,"%s",(cgiGetValue(cgi,"inpix1")!=NULL)?(cgiGetValue(cgi,"inpix1")):"");\r
-               sprintf(path1,"/var/tmp/%lu_1",(unsigned long)getpid());\r
-               \r
-               if(!act)\r
+               else\r
                {\r
-                       sub=fork();\r
-                       if(sub==0)\r
+                       t = cgiGetValue(cgi, "p0");\r
+                       if (t != NULL)\r
+                       {\r
+                               sscanf(t,"%"SCNuFAST8, &p0);\r
+                               size_defined=1;\r
+                       }\r
+                       else\r
+                               p0 = 0;\r
+                       \r
+                       t = cgiGetValue(cgi, "p1");\r
+                       if (t != NULL)\r
                        {\r
-                               t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",USERAGENT,"-O",path1,url1,(char *)0);\r
-                               exit(t);\r
+                               sscanf(t,"%"SCNuFAST8, &p1);\r
+                               size_defined=1;\r
                        }\r
-                       waitpid(sub,&t,0);\r
-                       if(t)mustard(t);\r
+                       else\r
+                               p1 = 0;\r
                }\r
-       }\r
-       \r
-       sub=fork();\r
-       if(sub==0)\r
-       {\r
-               switch (act)\r
+               \r
+               switch (action)\r
                {\r
-               case 0:\r
-                       t=execl(INS_PATH,INS_PATH,path0,path1,path0,(cgiGetValue(cgi,"r0")!=NULL)?(cgiGetValue(cgi,"r0")):"1",(cgiGetValue(cgi,"r1")!=NULL)?(cgiGetValue(cgi,"r1")):"0","q",(char *)0);\r
-                       exit(t);\r
-               case 1:\r
-               case 2:\r
-                       t=execl(EXT_PATH,EXT_PATH,path0,path0,path1,"q",(char *)0);\r
-                       exit(t);\r
-               case 3:\r
-                       t=execl(DIF_PATH,DIF_PATH,path0,path0,"q",(char *)0);\r
-                       exit(t);\r
-               default:\r
-                       exit(act);\r
+               case INSERT:\r
+                       r = insert(\r
+                               in0_path, in1_path, tmp2,\r
+                               p0, p1\r
+                       );\r
+                       break;\r
+               case EXTRACT_H:\r
+               case EXTRACT_V:\r
+                       r = extract(\r
+                               in0_path, tmp1, tmp2,\r
+                               size_defined,\r
+                               p0, p1\r
+                       );\r
+                       break;\r
+               case DETECT:\r
+                       r = detect(\r
+                               in0_path, tmp2,\r
+                               size_defined,\r
+                               p0, p1\r
+                       );\r
+                       break;\r
                }\r
+               if (r)\r
+                       break;\r
+               \r
+               r1 = send_file(\r
+                       (action == EXTRACT_H) ? tmp1 : tmp2,\r
+                       "image/png",\r
+                       0\r
+               );\r
+       } while (0);\r
+       if (r)\r
+       {\r
+               r1 = send_data(nclr, nclr_size, "image/png", 500);\r
        }\r
-       waitpid(sub,&t,0);\r
-       if(t)mustard(t);\r
+       r2 = rm(tmp0);\r
+       r3 = rm(tmp1);\r
+       r4 = rm(tmp2);\r
+       if (r1)\r
+               return r1;\r
+       if (r2)\r
+               return r2;\r
+       if (r3)\r
+               return r3;\r
+       if (r4)\r
+               return r4;\r
+       return 0;\r
+}\r
+\r
+int insert(\r
+       char *inpix0, char *inpix1, char *outpix,\r
+       uint_fast8_t r0, uint_fast8_t r1\r
+)\r
+{\r
+       char s_r0[4];\r
+       char s_r1[4];\r
        \r
-       pix=fopen((act==2?path1:path0),"rb");\r
-       if(pix==NULL)\r
-               mustard(123);\r
-       fstat(fileno(pix),&st);\r
-       p=st.st_size/1024;\r
-       q=st.st_size%1024;\r
+       pid_t sub;\r
+       int r;\r
        \r
-       printf("Content-Length: %lu\n",(unsigned long)(st.st_size));\r
-       printf("Content-type: image/png\n\n");\r
-       for(i=0;i<p;++i)\r
-       {\r
-               fread(buf,1,1024,pix);\r
-               fwrite(buf,1,1024,stdout);\r
-       }\r
-       if(q!=0)\r
+       snprintf(s_r0, 4, "%"PRIuFAST8, r0);\r
+       snprintf(s_r1, 4, "%"PRIuFAST8, r1);\r
+       \r
+       sub = fork();\r
+       if (sub == 0)\r
        {\r
-               fread(buf,1,q,pix);\r
-               fwrite(buf,1,q,stdout);\r
+               r = execl(\r
+                       PAL_MIX_PATH, PAL_MIX_PATH,\r
+                       inpix0, inpix1, outpix,\r
+                       s_r0, s_r1,\r
+                       (char *)0\r
+               );\r
+               exit(r);\r
        }\r
-       fclose(pix);\r
-       fflush(stdout);\r
-       mustard(0);//no mustard\r
-       return(0);\r
+       waitpid(sub, &r, 0);\r
+       return r;\r
 }\r
 \r
-void mustard(int mustard)\r
+int extract(\r
+       char *inpix, char *outpix0, char *outpix1,\r
+       uint_fast8_t size_defined,\r
+       uint_fast8_t p0, uint_fast8_t p1\r
+)\r
 {\r
-       if(mustard)\r
+       char s_p0[4];\r
+       char s_p1[4];\r
+       \r
+       pid_t sub;\r
+       int r;\r
+       \r
+       if (size_defined)\r
        {\r
-               cgiRedirect(MSTD_PATH);\r
+               snprintf(s_p0, 4, "%"PRIuFAST8, p0);\r
+               snprintf(s_p1, 4, "%"PRIuFAST8, p1);\r
        }\r
-       sub=fork();\r
-       if(sub==0)\r
+       \r
+       sub = fork();\r
+       if (sub == 0)\r
        {\r
-               t=execl(RM_PATH,RM_PATH,"-f",path0,(char *)0);\r
-               exit(t);\r
+               r = execl(\r
+                       PAL_UNMIX_PATH, PAL_UNMIX_PATH,\r
+                       inpix, outpix0, outpix1,\r
+                       size_defined ? s_p0 : ((char *) 0),\r
+                       size_defined ? s_p1 : ((char *) 0),\r
+                       (char *) 0\r
+               );\r
+               exit(r);\r
        }\r
-       waitpid(sub,&t,0);\r
+       waitpid(sub, &r, 0);\r
+       return r;\r
+}\r
+\r
+int detect(\r
+       char *inpix, char *outpix,\r
+       uint_fast8_t size_defined,\r
+       uint_fast8_t p0, uint_fast8_t p1\r
+)\r
+{\r
+       char s_p0[4];\r
+       char s_p1[4];\r
        \r
-       sub=fork();\r
-       if(sub==0)\r
+       pid_t sub;\r
+       int r;\r
+       \r
+       if (size_defined)\r
        {\r
-               t=execl(RM_PATH,RM_PATH,"-f",path1,(char *)0);\r
-               exit(t);\r
+               snprintf(s_p0, 4, "%"PRIuFAST8, p0);\r
+               snprintf(s_p1, 4, "%"PRIuFAST8, p1);\r
        }\r
-       waitpid(sub,&t,0);\r
        \r
-       pix=fopen(LOG_PATH,"at");\r
-       if(pix!=NULL)\r
+       sub = fork();\r
+       if (sub == 0)\r
        {\r
-               fprintf(pix,"%x %x %s %s\n",mustard,act,url0,url1);\r
-               fclose(pix);\r
+               r = execl(\r
+                       PAL_MIXDIFF_PATH, PAL_MIXDIFF_PATH,\r
+                       inpix, outpix,\r
+                       size_defined ? s_p0 : ((char *) 0),\r
+                       size_defined ? s_p1 : ((char *) 0),\r
+                       (char *) 0\r
+               );\r
+               exit(r);\r
        }\r
-       exit(mustard);\r
+       waitpid(sub, &r, 0);\r
+       return r;\r
 }\r
-\r
-\r
index ba5f9d4082523e97e73ef86b526bfc93a5a683a5..e3a00f9b2a373836ce701129f3d1ea19ef9a4931 100644 (file)
--- a/pal.1.htm
+++ b/pal.1.htm
@@ -1,15 +1,5 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">\r
-<html lang="pl">\r
-       <head>\r
-               <title>Hidden frames &bull; Bicycles on the Moon</title>\r
-               <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">\r
-               <link rel="stylesheet" href="/css/botm.css">\r
-               <link rel="icon" type="image/png" href="/img/favicon.png"/>\r
-       </head>\r
-       <body>\r
-               <a href="/"><img src="/img/botmlogo2.png" alt="1190.bicyclesonthemoon.info" border="0"></a>\r
-               <h1>Hidden frames</h1>\r
-               <form method="post" action="/cgi/insertframe/insertframe" enctype="multipart/form-data">\r
+            <h1>Hidden frames</h1>\r
+               <form method="post" action="/enhance/pal" enctype="multipart/form-data">\r
                        Upload frame(s):<br>\r
                        Frame 1: <input class="pt" type="file" name="inpixf0"><br>\r
                        Frame 2: <input class="pt" type="file" name="inpixf1"><br>\r
@@ -21,6 +11,9 @@
                        Visibility ratio:\r
                        <input class="pt" type="text" name="r0" value="1" size="1"> to <input class="pt" type="text" name="r1" value="0" size="1"><br>\r
                        <br>\r
+                       Palette sizes:\r
+                       1: <input class="pt" type="text" name="p0" size="2">, 2: <input class="pt" type="text" name="p1" size="2"><br>\r
+                       <br>\r
                        Select action:<br>\r
                        <input type="radio" class="pt" name="a" value="0">Insert<br>\r
                        <input type="radio" class="pt" name="a" value="1">Extract horizontally<br>\r
                        <br>\r
                        <input class="pk" type="submit" value="Do it."><br>\r
                        <br>\r
-                       When inserting you need two indexed images with the same size and the same number of colors.<br>\r
-                       When enhancing you need one indexed image with a squarish palette.\r
-                       \r
-                       \r
+                       When inserting you need two indexed images with the same size.<br>\r
+                       When enhancing you need one indexed image, if palette sizes not specified then square root is used.\r
                </form>\r
                <br>\r
-               Source code available at <a href="http://1190.bicyclesonthemoon.info/pro/insertframe">http://1190.bicyclesonthemoon.info/pro/insertframe</a>.<br>\r
-               Livensed under <a href="/a/agpl.txt">AGPL 3</a>.\r
-               \r
-       </body>\r
-</html>\r
index a03f077860e108b57f7d84d36671704291c9051b..43dfb0c8a558e2c5c0855a0e76c3d0d05e888534 100644 (file)
@@ -1,7 +1,7 @@
 /*
 reveal-cgi.c
 The online interface for the hidden detail revealer tool
-04.12.2022
+05.12.2022
 
 Copyright (C) 2022  Balthasar Szczepański
 
@@ -69,8 +69,6 @@ int main (int argc, char *argv[])
        }
        r2 = rm(in_tmp);
        r3 = rm(out_tmp);
-       if (r)
-               return r;
        if (r1)
                return r1;
        if (r2)
index 08fa7da0fc7668152f9771c1ac961d19bfbbd151..2596c29dad9d7da96fc08aed6ac6dfc68debb358 100644 (file)
@@ -18,6 +18,7 @@ title_diff: See the difference!
 title_enhance: ENHANCE!
 title_nofading: No fading!
 title_npb: It's NewpixbOTTification time!
+title_pal: Hidden frames
 title_reveal: Reveal hidden detail!
 
 bin_path: /botm/bin/enhance
index 8b0c9cd0e72c6d3e52b8907cfa5f925782dbd6da..e2668ba637363d7cce99a12a991ff046c4acbf3b 100644 (file)
@@ -27,6 +27,10 @@ _bin_nofading_path     = @_PATH($bin_path, nofading)
 _bin_nofading_cgi_path = @_PATH($bin_path, nofading-cgi)
 _bin_npb_path          = @_PATH($bin_path, npb)
 _bin_npb_cgi_path      = @_PATH($bin_path, npb-cgi)
+_bin_pal_mix_path      = @_PATH($bin_path, pal_mix)
+_bin_pal_mixdiff_path  = @_PATH($bin_path, pal_mixdiff)
+_bin_pal_unmix_path    = @_PATH($bin_path, pal_unmix)
+_bin_pal_cgi_path      = @_PATH($bin_path, pal-cgi)
 _bin_reveal_path       = @_PATH($bin_path, reveal)
 _bin_reveal_cgi_path   = @_PATH($bin_path, reveal-cgi)
 
@@ -40,6 +44,7 @@ CONF_bluenh   = $_bin_bluenh_cgi_path
 CONF_diff     = $_bin_diff_cgi_path
 CONF_nofading = $_bin_nofading_cgi_path
 CONF_npb      = $_bin_npb_cgi_path
+CONF_pal      = $_bin_pal_cgi_path
 CONF_reveal   = $_bin_reveal_cgi_path
 
 
@@ -73,8 +78,11 @@ C_RM_PATH   = @_C_DEFINE_STR(RM_PATH,   $rm)
 
 C_TEMP_PATH = @_C_DEFINE_STR(TEMP_PATH, $tmp_path)
 
-C_BLUENH_PATH   = @_C_DEFINE_STR(BLUENH_PATH,   $_bin_bluenh_path)
-C_DIFF_PATH     = @_C_DEFINE_STR(DIFF_PATH,     $_bin_diff_path)
-C_NOFADING_PATH = @_C_DEFINE_STR(NOFADING_PATH, $_bin_nofading_path)
-C_NPB_PATH      = @_C_DEFINE_STR(NPB_PATH,      $_bin_npb_path)
-C_REVEAL_PATH   = @_C_DEFINE_STR(REVEAL_PATH,   $_bin_reveal_path)
+C_BLUENH_PATH      = @_C_DEFINE_STR(BLUENH_PATH,      $_bin_bluenh_path)
+C_DIFF_PATH        = @_C_DEFINE_STR(DIFF_PATH,        $_bin_diff_path)
+C_NOFADING_PATH    = @_C_DEFINE_STR(NOFADING_PATH,    $_bin_nofading_path)
+C_NPB_PATH         = @_C_DEFINE_STR(NPB_PATH,         $_bin_npb_path)
+C_PAL_MIX_PATH     = @_C_DEFINE_STR(PAL_MIX_PATH,     $_bin_pal_mix_path)
+C_PAL_MIXDIFF_PATH = @_C_DEFINE_STR(PAL_MIXDIFF_PATH, $_bin_pal_mixdiff_path)
+C_PAL_UNMIX_PATH   = @_C_DEFINE_STR(PAL_UNMIX_PATH,   $_bin_pal_unmix_path)
+C_REVEAL_PATH      = @_C_DEFINE_STR(REVEAL_PATH,      $_bin_reveal_path)