]> git.sesse.net Git - qscale/blob - qscale.c
Link with LD=gcc; fixes a problem with missing reference to __stack_chk_fail_local.
[qscale] / qscale.c
1 /*
2  * qscale: Quick, high-quality JPEG-to-JPEG scaler.
3  * Copyright (C) 2008 Steinar H. Gunderson <sgunderson@bigfoot.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, version 2 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
17  */
18
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include "libqscale.h"
22
23 int main(int argc, char **argv)
24 {
25         /* user-settable parameters */
26         unsigned nominal_w = atoi(argv[1]);
27         unsigned nominal_h = atoi(argv[2]);
28         unsigned samp_h0 = 2, samp_v0 = 2;
29         unsigned samp_h1 = 1, samp_v1 = 1;
30         unsigned samp_h2 = 1, samp_v2 = 1;
31         unsigned jpeg_quality = 85;
32         /* end */
33
34         qscale_img *img = qscale_load_jpeg_from_stdio(stdin);
35         qscale_img *scaled = qscale_scale(img, nominal_w, nominal_h, samp_h0, samp_v0, samp_h1, samp_v1, samp_h2, samp_v2, LANCZOS);
36         qscale_destroy(img);
37         qscale_save_jpeg_to_stdio(scaled, stdout, jpeg_quality, SEQUENTIAL);
38
39         return 0;
40 }
41