]> git.sesse.net Git - qscale/blobdiff - libqscale.c
Fix so loading/saving from other stuff than stdin/stdout actually works.
[qscale] / libqscale.c
index 168cb8ec13bf681010e0e227251fb0344eac167e..c02aa1a58ee685471f2a0fa31157341ea363432c 100644 (file)
@@ -1,3 +1,21 @@
+/*
+ * qscale: Quick, high-quality JPEG-to-JPEG scaler.
+ * Copyright (C) 2008 Steinar H. Gunderson <sgunderson@bigfoot.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -51,7 +69,7 @@ qscale_img *qscale_load_jpeg_from_stdio(FILE *file)
        struct jpeg_error_mgr jerr;
        dinfo.err = jpeg_std_error(&jerr);
        jpeg_create_decompress(&dinfo);
-       jpeg_stdio_src(&dinfo, stdin);
+       jpeg_stdio_src(&dinfo, file);
        jpeg_read_header(&dinfo, TRUE);
        dinfo.raw_data_out = TRUE;
        jpeg_start_decompress(&dinfo);
@@ -555,7 +573,7 @@ int qscale_save_jpeg_to_stdio(const qscale_img *img, FILE *file, unsigned jpeg_q
         struct jpeg_error_mgr jerr;
         cinfo.err = jpeg_std_error(&jerr);
         jpeg_create_compress(&cinfo);
-        jpeg_stdio_dest(&cinfo, stdout);
+        jpeg_stdio_dest(&cinfo, file);
         cinfo.input_components = 3;
         jpeg_set_defaults(&cinfo);
         jpeg_set_quality(&cinfo, jpeg_quality, FALSE);