Changeset 2263


Ignore:
Timestamp:
Mar 11, 2008, 3:56:42 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Implemented 24 -> 16 bpp dithering.
  • Added the --bpp flag to genethumb.
Location:
libpipi/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/genethumb/genethumb.c

    r2258 r2263  
    2828    pipi_image_t *src, *dst;
    2929
    30     int i, w = 0, h = 0;
     30    int i, w = 0, h = 0, bpp = 24;
    3131
    3232    for(;;)
     
    3636        {
    3737            { "geometry",    1, NULL, 'g' },
     38            { "bpp",         1, NULL, 'b' },
    3839        };
    39         int c = mygetopt(argc, argv, "g:", long_options, &option_index);
     40        int c = mygetopt(argc, argv, "g:b:", long_options, &option_index);
    4041
    4142        if(c == -1)
     
    4445        switch(c)
    4546        {
     47        case 'b':
     48            bpp = atoi(myoptarg);
     49            if(bpp != 32 && bpp != 24 && bpp != 16)
     50            {
     51                fprintf(stderr, "%s: invalid bpp -- %s\n", argv[0], myoptarg);
     52                return EXIT_FAILURE;
     53            }
     54            break;
    4655        case 'g':
    4756            w = atoi(myoptarg);
     
    6675    src = pipi_load(srcname);
    6776    dst = pipi_resize(src, w, h);
     77    if(bpp == 16)
     78        pipi_dither_24to16(dst);
    6879    pipi_save(dst, dstname);
    6980    pipi_free(src);
  • libpipi/trunk/pipi/Makefile.am

    r2262 r2263  
    2525        codec.c \
    2626        resize.c \
     27        dither.c \
    2728        test.c \
    2829        $(codec_sources) \
  • libpipi/trunk/pipi/pipi.h

    r2262 r2263  
    4141extern pipi_image_t *pipi_resize(pipi_image_t const *, int, int);
    4242
     43extern void pipi_dither_24to16(pipi_image_t *img);
     44
    4345extern void pipi_test(pipi_image_t *);
    4446
Note: See TracChangeset for help on using the changeset viewer.