image大名鼎鼎,无人不晓。而imaged.exe是作为向image致敬的产品。支持你无法想象的多得多参数杂糅。专注图像多参显示,且根据你输入的参数的不同,做出不同的函数重载,输几个参数都行,不强求,非常自然。专为论坛、贴吧中喜欢制作批处理游戏的高端玩家打造。能够随意缩放图像尺寸,任意角度显示,图像裁剪...,让你的批处理游戏美轮美奂。非常严谨的错误反馈,一点小错都会报出英文说明,让严格贯穿始终。同时为了体积,使用了VS的神优化,只有10KB方便下载。 | IMAGED.EXE | | | | 摘要: | | ============================================================================= | | CMD控制台图片显示工具,支持bmp、png、gif、jpg、jpeg、tiff、exif、ico等多种 | | 图片显示,包括12种参数自由设定,支持图片旋转、缩小、透明显示等特效。 | | ============================================================================= | | | | 下载: | | 用法: | | ----------------------------------------------------------------------------- | | imaged [options] {arguments}... | | ----------------------------------------------------------------------------- | | BASE: | | [file] [cmd_x] [cmd_y] [cmd_with] [cmd_high] | | [src_x] [src_y] [src_with] [src_high] | | [rot_x] [rot_y] [rot_angle] | | OTHER: | | /help Show help information | | /hide Hide the cursor | | /show Show the cursor | | /clean [x] [y] [with] [high] | | ----------------------------------------------------------------------------- | | | | 示例: | | ----------------------------------------------------------------------------- | | imaged test.png 0 0 100 100 0 0 100 100 50 50 30 | | ----------------------------------------------------------------------------- | | | | 备注: | | ----------------------------------------------------------------- | | CONSOLE IMAGE DISPLAY TOOL, COPYRIGHT@2017~2019 BY HAPPY | | ----------------------------------------------------------------- | | imaged [options] {arguments}... | | ----------------------------------------------------------------- | | BASE: | | [file] [cmd_x] [cmd_y] [cmd_with] [cmd_high] | | [src_x] [src_y] [src_with] [src_high] | | [rot_x] [rot_y] [rot_angle] Draw an image | | OTHER: | | /help Show help information | | /hide Hide the cursor | | /show Show the cursor | | /clean [x] [y] [with] [high] Clear the image | | ----------------------------------------------------------------- | | 2017-02-06, VERSION 1.0"COPY |
仅支持VS2010编译
原创代码: | | | | | | | | | | | #include <stdio.h> | | #include <Windows.h> | | #include <gdiplus.h> | | #pragma comment(lib, "GdiPlus.lib") | | | | | | using namespace Gdiplus; | | | | | | #define HELP_INFORMATION "\ | | -----------------------------------------------------------------\n\ | | CONSOLE IMAGE DISPLAY TOOL, COPYRIGHT@2017~2019 BY HAPPY\n\ | | -----------------------------------------------------------------\n\ | | imaged [options] {arguments}...\n\ | | -----------------------------------------------------------------\n\ | | BASE:\n\ | | [file] [cmd_x] [cmd_y] [cmd_with] [cmd_high]\n\ | | [src_x] [src_y] [src_with] [src_high]\n\ | | [rot_x] [rot_y] [rot_angle] Draw an image\n\ | | OTHER:\n\ | | /help Show help information\n\ | | /hide Hide the cursor\n\ | | /show Show the cursor\n\ | | /clean [x] [y] [with] [high] Clear the image\n\ | | -----------------------------------------------------------------\n\ | | 2017-02-03, VERSION 1.0" | | | | | | | | #define SENSITIVE_NUM 6 | | static const char* SENSITIVE_WORDS[]={"/HIDE", "/SHOW", "/CLEAN", "/HELP", "/H", "/?"}; | | static int PRIVATIVE_PAR[11]={0}; | | | | | | | | WCHAR* L(const CHAR* str) | | { | | if(!str){return NULL;} | | int wLen=MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str, -1, NULL, 0); | | WCHAR* wstr=(WCHAR*)malloc(sizeof(WCHAR)*wLen + 1); | | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str, -1, wstr, wLen); | | wstr[wLen]='\0'; | | return wstr; | | } | | | | int itifyWORDS(const char* strARGV) | | { | | int SN; | | for(SN=0; SN<SENSITIVE_NUM; SN++){ | | char *op=(char*)strARGV, *kp=(char*)SENSITIVE_WORDS[SN]; | | while(*kp!='\0'){ | | if( (('a'<= *op && *op<='z')?*op-32:*op) != (('a'<= *kp && *kp<='z')?*kp-32:*kp) ){break;} | | op++;kp++; | | } | | if( (*kp=='\0') && (*op==' '||*op=='\t'||*op=='\r'||*op=='\n'||*op=='\0') ){return SN;} | | } | | return -1; | | } | | | | BOOL DispyCursor(int size,bool mode) | | { | | CONSOLE_CURSOR_INFO cinfo ={(DWORD)size, mode}; | | return SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cinfo); | | } | | | | void OptRE(HWND hCMD, HDC hDC, int argc, char** argv) | | { | | | | int oargc=argc-1; | | if(oargc==0){ | | | | fputs(HELP_INFORMATION, stderr); | | exit(1); | | } | | | | | | char** oargv=argv; | | | | | | int SN=itifyWORDS(argv[1]); | | if(SN!=-1){ | | | | switch(SN) | | { | | case 0: | | case 1: | | | | DispyCursor((DWORD)25, (SN==0)?FALSE:TRUE); | | break; | | | | case 2: | | | | if(oargc!=5){ | | InvalidateRect(hCMD, NULL, FALSE); | | }else{ | | RECT rc={atoi(argv[2]), atoi(argv[3]), atoi(argv[2])+atoi(argv[4]), atoi(argv[3])+atoi(argv[5])}; | | InvalidateRect(hCMD, &rc, FALSE); | | } | | break; | | | | default: | | | | fputs(HELP_INFORMATION, stderr); | | exit(0); | | } | | | | }else{ | | | | | | Image* srcIMG=NULL; | | if((srcIMG=Image::FromFile(L(argv[1])))==NULL){ | | fputs("Read the image failed", stderr); | | exit(1); | | } | | | | int anum; | | for(anum=0; anum<11; anum++){ | | if(anum+2<=oargc){ | | PRIVATIVE_PAR[anum]=atoi(argv[anum+2]); | | } | | if ((anum==2||anum==6) && (PRIVATIVE_PAR[anum]==0)){ | | PRIVATIVE_PAR[anum]=srcIMG->GetWidth(); | | }else if((anum==3||anum==7) && (PRIVATIVE_PAR[anum]==0)){ | | PRIVATIVE_PAR[anum]=srcIMG->GetHeight(); | | } | | } | | | | | | Matrix matri; | | matri.Reset(); | | matri.RotateAt((float)PRIVATIVE_PAR[10], PointF((float)PRIVATIVE_PAR[8], (float)PRIVATIVE_PAR[9])); | | | | | | Graphics graph(hDC); | | graph.SetTransform(&matri); | | | | | | Status s=graph.DrawImage(srcIMG, Rect(PRIVATIVE_PAR[0],PRIVATIVE_PAR[1],PRIVATIVE_PAR[2],PRIVATIVE_PAR[3]), PRIVATIVE_PAR[4],PRIVATIVE_PAR[5],PRIVATIVE_PAR[6],PRIVATIVE_PAR[7], UnitPixel); | | if(s!=Ok){ | | fputs("Drawing the image failed", stderr); | | exit(1); | | } | | } | | } | | | | | | int main(int argc, char** argv) | | { | | | | ULONG_PTR gdipludToken; | | GdiplusStartupInput gdiplusInput; | | GdiplusStartup(&gdipludToken,&gdiplusInput,NULL); | | | | | | HWND hCMD=GetConsoleWindow(); | | HDC hDC =GetDC(hCMD); | | | | | | OptRE(hCMD, hDC, argc, argv); | | | | | | ReleaseDC(hCMD, hDC); | | DeleteDC(hDC); | | | | | | GdiplusShutdown(gdipludToken); | | return 0; | | }COPY |
|