summarylogtreecommitdiffstats
path: root/dpi.patch
diff options
context:
space:
mode:
authorChristopher Hillenbrand2022-10-02 15:24:32 -0400
committerChristopher Hillenbrand2022-10-02 15:24:32 -0400
commita045f7ec1e571d82f8d93971a4589972e245cd45 (patch)
tree84863e3ff5dc81f97459931d685a3cd77ff83663 /dpi.patch
parent9c0b87ad7a6bdf0250cc7a4874df3e46a4c74da5 (diff)
downloadaur-a045f7ec1e571d82f8d93971a4589972e245cd45.tar.gz
add hanging commit and dpi patch (see CHANGELOG)
Diffstat (limited to 'dpi.patch')
-rw-r--r--dpi.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/dpi.patch b/dpi.patch
new file mode 100644
index 000000000000..6de7056329d7
--- /dev/null
+++ b/dpi.patch
@@ -0,0 +1,58 @@
+diff --git a/src/jbig2.cc b/src/jbig2.cc
+index 0bddb90..9447350 100644
+--- a/src/jbig2.cc
++++ b/src/jbig2.cc
+@@ -55,6 +55,7 @@ usage(const char *argv0) {
+ fprintf(stderr, " -S: remove images from mixed input and save separately\n");
+ fprintf(stderr, " -j --jpeg-output: write images from mixed input as JPEG\n");
+ fprintf(stderr, " -a --auto-thresh: use automatic thresholding in symbol encoder\n");
++ fprintf(stderr, " -D --dpi: force dpi\n");
+ fprintf(stderr, " --no-hash: disables use of hash function for automatic thresholding\n");
+ fprintf(stderr, " -V --version: version info\n");
+ fprintf(stderr, " -v: be verbose\n");
+@@ -218,6 +219,7 @@ main(int argc, char **argv) {
+ bool segment = false;
+ bool auto_thresh = false;
+ bool hash = true;
++ int dpi = 0;
+ int i;
+
+ #ifdef WIN32
+@@ -353,6 +355,24 @@ main(int argc, char **argv) {
+ continue;
+ }
+
++ if (strcmp(argv[i], "-D") == 0 ||
++ strcmp(argv[i], "--dpi") == 0) {
++ char *endptr;
++ long t_dpi = strtol(argv[i+1], &endptr, 10);
++ if (*endptr) {
++ fprintf(stderr, "Cannot parse int value: %s\n", argv[i+1]);
++ usage(argv[0]);
++ return 1;
++ }
++ if (t_dpi <= 0 || t_dpi > 9600) {
++ fprintf(stderr, "Invalid dpi: (1..9600)\n");
++ return 12;
++ }
++ dpi = (int)t_dpi;
++ i++;
++ continue;
++ }
++
+ break;
+ }
+
+@@ -402,6 +422,11 @@ main(int argc, char **argv) {
+ source = pixReadTiff(argv[i], subimage++);
+ }
+
++ if (dpi != 0 && source->xres == 0 && source->yres == 0) {
++ source->xres = dpi;
++ source->yres = dpi;
++ }
++
+ if (!source) return 3;
+ if (verbose)
+ pixInfo(source, "source image:");
+