Changeset 4934 for tools/grab/main.c


Ignore:
Timestamp:
12/20/10 22:29:05 (13 years ago)
Author:
nit
Message:

[grab] add option -i for hight

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/grab/main.c

    r4899 r4934  
    131131
    132132        int xres_v,yres_v,xres_o,yres_o,xres,yres,aspect;
    133         int c,osd_only,video_only,use_osd_res,width,use_png,use_jpg,jpg_quality,no_aspect,use_letterbox;
     133        int c,osd_only,video_only,use_osd_res,width,own_hight,use_png,use_jpg,jpg_quality,no_aspect,use_letterbox;
    134134
    135135        // we use fast resize as standard now
    136136        resize = &fast_resize;
    137137       
    138         osd_only=video_only=use_osd_res=width=use_png=use_jpg=no_aspect=use_letterbox=0;
     138        osd_only=video_only=use_osd_res=width=own_hight=use_png=use_jpg=no_aspect=use_letterbox=0;
    139139        jpg_quality=50;
    140140        aspect=1;
     
    146146       
    147147        // process command line
    148         while ((c = getopt (argc, argv, "dhj:lbnopr:vf:")) != -1)
     148        while ((c = getopt (argc, argv, "dhj:lbnopir:vf:")) != -1)
    149149        {
    150150                switch (c)
     
    160160                                printf("-n dont correct 16:9 aspect ratio\n");
    161161                                printf("-r (size) resize to a fixed width, maximum: 1920\n");
     162                                printf("-i (size) resize to a fixed hight (only with -r), maximum: 1920\n");
    162163                                printf("-l always 4:3, create letterbox if 16:9\n");
    163164                                printf("-b use bicubic picture resize (slow but smooth)\n");
     
    187188                                {
    188189                                        printf("[grab] Error: -r (size) ist limited to 1920 pixel !\n");
     190                                        return 1;
     191                                }
     192                                break;
     193                        case 'i': // use given resolution
     194                                own_hight=atoi(optarg);
     195                                if (own_hight > 1920)
     196                                {
     197                                        printf("[grab] Error: -i (size) ist limited to 1920 pixel !\n");
    189198                                        return 1;
    190199                                }
     
    291300        if (width)
    292301        {
    293                 printf("[grab] Resizing Screenshot to %d x %d ...\n",width,yres*width/xres);
    294                 resize(output,video,xres,yres,width,(yres*width/xres),3);
    295                 yres=yres*width/xres;
     302                if (own_hight == 0)
     303                        own_hight = yres*width/xres;
     304                printf("[grab] Resizing Screenshot to %d x %d ...\n",width,own_hight);
     305                resize(output,video,xres,yres,width,(own_hight),3);
     306                yres=own_hight;
    296307                xres=width;
    297308                memcpy(output,video,xres*yres*3);
Note: See TracChangeset for help on using the changeset viewer.