resize-gd

changeset 7:c0045d8d3ce2 0.1

improved comment at begin of source; some cleanups
author meillo@marmaro.de
date Sat, 14 Jun 2008 12:33:33 +0200
parents e020f26c2c6a
children 6f0826fdec50
files resize-gd.c
diffstat 1 files changed, 7 insertions(+), 22 deletions(-) [+]
line diff
     1.1 --- a/resize-gd.c	Sat Jun 14 12:19:35 2008 +0200
     1.2 +++ b/resize-gd.c	Sat Jun 14 12:33:33 2008 +0200
     1.3 @@ -1,21 +1,17 @@
     1.4  /*
     1.5 - * compile with: gcc -lgd -lpng -lz -ljpeg  -lm resize-gd.c
     1.6 + * resize-gd - resizes images using the gd-library
     1.7 + *
     1.8 + * Copyright 2008 by markus schnalke <meillo@marmaro.de>
     1.9 + *
    1.10   * build-depends: libgd2-noxpm-dev | libgd2-dev
    1.11   * depends: libgd2-noxpm | libgd2-xpm
    1.12 - *
    1.13 - *
    1.14 - *
    1.15 - * http://www.libgd.org/ImageCreation
    1.16 - * http://cpan.uwinnipeg.ca/htdocs/Image-Resize/Image/Resize.pm.html
    1.17 - * http://netpbm.sourceforge.net/
    1.18 - *
    1.19   */
    1.20  
    1.21  #include <stdio.h>
    1.22 -#include <stdlib.h>  /* for atoi() */
    1.23 +#include <stdlib.h>
    1.24  #include <string.h>
    1.25  #include <ctype.h>
    1.26 -#include "gd.h" /* Bring in the gd library functions */
    1.27 +#include "gd.h"
    1.28  
    1.29  #define PROGRAM "resize-gd"
    1.30  #define VERSION "0.1"
    1.31 @@ -142,25 +138,14 @@
    1.32  			fprintf(stderr, "'%s' has unknown filetype. Filename must end with (lowercase) '.png' or '.jpg'.\n", argv[i]);
    1.33  			continue;
    1.34  		}
    1.35 +
    1.36  		/* load image */
    1.37  		in = fopen(argv[i], "rb");
    1.38 -
    1.39  		if (type == Png) {
    1.40  			im_in = gdImageCreateFromPng(in);
    1.41  		} else if (type == Jpg) {
    1.42  			im_in = gdImageCreateFromJpeg(in);
    1.43  		}
    1.44 -		/*
    1.45 -		if ((im_in = gdImageCreateFromPng(in)) != NULL) {
    1.46 -			type = Png;
    1.47 -		} else if ((im_in = gdImageCreateFromJpeg(in)) != NULL) {
    1.48 -			type = Jpg;
    1.49 -		} else {
    1.50 -			fprintf(stderr, "'%s' has unknown filetype. Filename must end with (lowercase) '.png' or '.jpg'.\n", argv[i]);
    1.51 -			continue;
    1.52 -		}
    1.53 -		*/
    1.54 -
    1.55  		fclose(in);
    1.56  
    1.57  		/* calculate target size */