* jpg programs patch
@ 2019-01-18 19:43 Iroironameeru
0 siblings, 0 replies; only message in thread
From: Iroironameeru @ 2019-01-18 19:43 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
Currently, programs in cmd/jpg ruin image colors if you pass -9 or -c, unless you also pass -t. this is obnoxious and theres really no good reason for it anymore.
This patch changes the default color map to RGB24 in all the relevant programs. -9 and -t cease to set the color map to CMAP8. -t is still present, and still sets all the other flags a program or script might expect it to(like no display), but does nothing special.
since -t is still there and acting like it should, this shouldn't break anything unless it uses some kind of hack where the color map has to be CMAP8. documents with images, page, mothra, all work fine with this change.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: peggy.diff --]
[-- Type: text/x-patch; name="peggy.diff", Size: 7381 bytes --]
diff -r 8c50688cb280 sys/src/cmd/jpg/bmp.c
--- a/sys/src/cmd/jpg/bmp.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/bmp.c Fri Jan 18 13:33:15 2019 -0500
@@ -12,7 +12,7 @@
int nineflag = 0;
int threeflag = 0;
int output = 0;
-ulong outchan = CMAP8;
+ulong outchan = RGB24;
int defaultcolor = 1;
Image *image;
@@ -67,14 +67,11 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
case 'c': /* produce encoded, compressed, bitmap file; no display by default */
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
case 'd': /* suppress display of image */
dflag++;
@@ -94,8 +91,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
fprint(2, "usage: bmp -39cdektv [file.bmp ...]\n");
diff -r 8c50688cb280 sys/src/cmd/jpg/gif.c
--- a/sys/src/cmd/jpg/gif.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/gif.c Fri Jan 18 13:33:15 2019 -0500
@@ -12,7 +12,7 @@
int nineflag = 0;
int threeflag = 0;
int output = 0;
-ulong outchan = CMAP8;
+ulong outchan = RGB24;
Image **allims;
int which;
int defaultcolor = 1;
@@ -69,14 +69,11 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
case 'c': /* produce encoded, compressed, bitmap file; no display by default */
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
case 'd': /* suppress display of image */
dflag++;
@@ -96,8 +93,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
fprint(2, "usage: gif -39cdektv [file.gif ...]\n");
diff -r 8c50688cb280 sys/src/cmd/jpg/jpg.c
--- a/sys/src/cmd/jpg/jpg.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/jpg.c Fri Jan 18 13:33:15 2019 -0500
@@ -16,7 +16,7 @@
int threeflag = 0;
int colorspace = CYCbCr; /* default for 8-bit displays: combine color rotation with dither */
int output = 0;
-ulong outchan = CMAP8;
+ulong outchan = RGB24;
Image *image;
int defaultcolor = 1;
@@ -67,8 +67,6 @@
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
case 'd': /* suppress display of image */
dflag++;
@@ -101,7 +99,6 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
case 'v': /* force RGBV */
defaultcolor = 0;
@@ -115,8 +112,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
fprint(2, "usage: jpg -39cdefFkJrtvy [file.jpg ...]\n");
diff -r 8c50688cb280 sys/src/cmd/jpg/png.c
--- a/sys/src/cmd/jpg/png.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/png.c Fri Jan 18 13:33:15 2019 -0500
@@ -13,7 +13,7 @@
int nineflag = 0;
int threeflag = 0;
int output = 0;
-ulong outchan = CMAP8;
+ulong outchan = RGB24;
Image *image;
int defaultcolor = 1;
@@ -62,8 +62,6 @@
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
case 'D':
debug++;
@@ -86,7 +84,6 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
case 'v': /* force RGBV */
defaultcolor = 0;
@@ -96,8 +93,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
fprint(2, "usage: png [-39cdekrtv] [file.png ...]\n");
diff -r 8c50688cb280 sys/src/cmd/jpg/ppm.c
--- a/sys/src/cmd/jpg/ppm.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/ppm.c Fri Jan 18 13:33:15 2019 -0500
@@ -12,7 +12,7 @@
int nineflag = 0;
int threeflag = 0;
int output = 0;
-ulong outchan = CMAP8;
+ulong outchan = RGB24;
int defaultcolor = 1;
Image *image;
@@ -65,14 +65,11 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
case 'c': /* produce encoded, compressed, bitmap file; no display by default */
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
case 'd': /* suppress display of image */
dflag++;
@@ -92,8 +89,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
fprint(2, "usage: ppm -39cdektv [file.ppm ...]\n");
diff -r 8c50688cb280 sys/src/cmd/jpg/tga.c
--- a/sys/src/cmd/jpg/tga.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/tga.c Fri Jan 18 13:33:15 2019 -0500
@@ -12,7 +12,7 @@
int nineflag = 0;
int threeflag = 0;
int output = 0;
-ulong outchan = CMAP8;
+ulong outchan = RGB24;
int defaultcolor = 1;
Image *image;
@@ -67,14 +67,11 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
case 'c': /* produce encoded, compressed, bitmap file; no display by default */
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
case 'd': /* suppress display of image */
dflag++;
@@ -94,8 +91,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
fprint(2, "usage: tga -39cdektv [file ...]\n");
diff -r 8c50688cb280 sys/src/cmd/jpg/tif.c
--- a/sys/src/cmd/jpg/tif.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/tif.c Fri Jan 18 13:33:15 2019 -0500
@@ -62,7 +62,7 @@
char *err;
ulong outchan;
- outchan = CMAP8;
+ outchan = RGB24;
ARGBEGIN {
/*
* produce encoded, compressed, bitmap file;
@@ -72,8 +72,6 @@
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
/* suppress display of image */
case 'd':
@@ -104,7 +102,6 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
/* force RGBV */
case 'v':
@@ -119,8 +116,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
usage();
diff -r 8c50688cb280 sys/src/cmd/jpg/v210.c
--- a/sys/src/cmd/jpg/v210.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/v210.c Fri Jan 18 13:33:15 2019 -0500
@@ -12,7 +12,7 @@
int nineflag = 0;
int threeflag = 0;
int output = 0;
-ulong outchan = CMAP8;
+ulong outchan = RGB24;
int defaultcolor = 1;
Image *image;
@@ -67,14 +67,11 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
case 'c': /* produce encoded, compressed, bitmap file; no display by default */
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
case 'd': /* suppress display of image */
dflag++;
@@ -94,8 +91,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
fprint(2, "usage: %s -39cdektv [file.yuv ...]\n", argv0);
diff -r 8c50688cb280 sys/src/cmd/jpg/yuv.c
--- a/sys/src/cmd/jpg/yuv.c Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/jpg/yuv.c Fri Jan 18 13:33:15 2019 -0500
@@ -12,7 +12,7 @@
int nineflag = 0;
int threeflag = 0;
int output = 0;
-ulong outchan = CMAP8;
+ulong outchan = RGB24;
int defaultcolor = 1;
Image *image;
@@ -67,14 +67,11 @@
dflag++;
output++;
defaultcolor = 0;
- outchan = RGB24;
break;
case 'c': /* produce encoded, compressed, bitmap file; no display by default */
cflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
case 'd': /* suppress display of image */
dflag++;
@@ -94,8 +91,6 @@
nineflag++;
dflag++;
output++;
- if(defaultcolor)
- outchan = CMAP8;
break;
default:
fprint(2, "usage: yuv -39cdektv [file.yuv ...]\n");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-01-18 19:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18 19:43 jpg programs patch Iroironameeru
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).