?? png2open.c
字號:
/***
* png2open.c
***
* 2007-04-30
* xbarin02@stud.fit.vutbr.cz
***
* utilita pro konverzi PNG => OPEN
*/
#undef __STRICT_ANSI__
#include "open.h"
#include "error.h"
#include "pngfunc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/***
* parametry:
* <png> <open> <metoda> <kvalita>
*/
int main(int argc, char *argv[])
{
if(argc != 5)
{
printf("Pouziti: ");
printf(argv[0]);
printf(" <vstup.png> <vystup.open> <metoda> <kvalita>\n");
printf("\t<metoda>: dct, dwt; <kvalita>: 0..100\n");
return(EXIT_FAILURE);
}
char *ifn = argv[1];
char *ofn = argv[2];
char *mth = argv[3];
char *qlt = argv[4];
openMethod method;
if(0 == strcasecmp(mth,"dct"))
method = DCT;
else
if(0 == strcasecmp(mth,"dwt"))
method = DWT;
else
{
printf("Chyba: neznama metoda.\n");
return(EXIT_FAILURE);
}
int quality = atoi(qlt);
if(!(1 <= quality && quality <= 100))
{
printf("Chyba: neplatna kvalita.\n");
return(EXIT_FAILURE);
}
dprintf("Debug: %s %s %i %i\n",ifn,ofn,method,quality);
int ret = check_sizeof();
if(ret)
{
eprintf("Error in size of data types (%i).",ret);
return(EXIT_FAILURE);
}
PFrameBuff image = loadpng(ifn);
if( NULL == image )
{
printf("Chyba pri nacitani PNG obrazku.\n");
return(EXIT_FAILURE);
}
FILE *f;
if( NULL == (f = fopen(ofn, "wb")) )
{
printf("Chyba pri otevirani vystupniho souboru!");
return(EXIT_FAILURE);
}
int res = openCompress(f, image, method, quality);
fclose(f);
if(res)
{
printf("Komprese selhala!");
return(EXIT_FAILURE);
}
return(EXIT_SUCCESS);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -