-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpicture_scale.cpp
More file actions
30 lines (28 loc) · 793 Bytes
/
picture_scale.cpp
File metadata and controls
30 lines (28 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "core/GLBmp.h"
#include "utils/GLDebug.h"
#include <string>
#include <fstream>
#include <sstream>
#include "GL/GLBitmapWorkFactory.h"
#include <map>
#include "GL/GLContext.h"
#include "GL/GLBitmapWork.h"
using namespace std;
int main(int argc, char* argv[])
{
GLASSERT(argc>=4);
GLAutoContext __c;
const char* inputfile = argv[1];
const char* outputfile = argv[2];
float scale = atof(argv[3]);
GPPtr<GLBmp> src = new GLBmp(inputfile);
printf("Origin Picture: %d X %d\n", src->width(), src->height());
GPPtr<GLBmp> dst = new GLBmp(src->width()*scale, src->height()*scale);
{
GPPtr<GLBitmapWork> w = GLBitmapWorkFactory::create("Bicubic");
w->set(src, dst);
w->runOnePass();
}
dst->save(outputfile);
return 1;
}