rtoss

Subversion Repositories:
Compare Path: Rev
With Path: Rev
/ @ 183  →  / @ 184
New file
/repng2jpeg/readme.txt
@@ -0,0 +1,121 @@
23:00 2004/08/05
suga@snpn.net
 
repng2jpeg 1.0.4
 
jpeg,png,gif => jpeg,png,gif ‚̃tƒH[ƒ}ƒbƒg‚¨‚æ‚уTƒCƒY•ÏX
 
‚ ‚ñ‚Ü‚èŽg‚¢“¹‚à–³‚¢‚ÆŽv‚Á‚Ä‚¢‚½‚Ì‚Å‚·‚ª
‚»‚ê‚È‚è‚ÉŽg‚¤l‚ª‚¢‚é‚Á‚Û‚¢‚Ì‚Å‚Ü‚Æ‚ß‚Ä‚¨‚¢‚Ä‚¨‚«‚Ü‚·
 
“¯«‚µ‚Ä‚ ‚éƒoƒCƒiƒŠ‚̓Rƒ“ƒpƒCƒ‹ŠÂ‹«‚É‹ß‚¯‚ê‚Î
‚»‚Ì‚Ü‚Ü“®‚­‰Â”\«‚à‚ ‚é‚Æ‚¢‚¤‚¨‚Ü‚¯’ö“x‚È‚Ì‚Å
“®‚©‚È‚©‚Á‚½‚ç‚ ‚«‚ç‚߂邱‚Æ‚à•K—v‚Å‚·(‚§
 
‚¨–ñ‘©Ž–‚Å‚·‚ª‚±‚̃A[ƒJƒCƒu‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚é
ƒoƒCƒiƒŠ/ƒ\[ƒX‚ÍŠeŽ©‚̐ӔC‚É‚¨‚¢‚Ä‚²—˜—p‰º‚³‚¢
 
OS‚É‚æ‚Á‚Ä‚¢‚­‚‚©—pˆÓ‚µ‚Ä‚Ý‚Ü‚µ‚½
dynamic : libjpeg libpng ‚Ì‹¤—Lƒ‰ƒCƒuƒ‰ƒŠ‚ð•K—v‚Æ‚·‚é‚à‚Ì ƒtƒ@ƒCƒ‹ƒTƒCƒY¬
standard : libjpeg libpng ‚Ístatic‚É‚µ‚Ä‚ ‚é‚à‚Ì libc‚ ‚½‚è‚̃o[ƒWƒ‡ƒ“‚ª“¯‚¶‚È‚ç“®‚­‚Í‚¸
static : ƒXƒ^ƒeƒBƒbƒNƒoƒCƒiƒŠ ex.linux”Å‚ÍlinuxƒJ[ƒlƒ‹‚ª“®‚¢‚Ä‚¢‚ê‚Γ®‚­‚©‚à
 
‰º‚ɍs‚­‚Ù‚ÇŽg‚¤‹¤—Lƒ‰ƒCƒuƒ‰ƒŠ‚ª­‚È‚¢‚Ì‚Å“®‚­‰Â”\«‚ª‚‚¢‚Å‚·A
‚»‚Ì‚©‚í‚èƒtƒ@ƒCƒ‹ƒTƒCƒY‚ª‘å‚«‚­‚È‚è‚Ü‚·B
 
---
ƒRƒ}ƒ“ƒh‚ÌŽg‚¢•û
 
$repng2jpeg inputfile outputfile (width height|Z ratio) [Quality|P|G]
 
inputfile -> “ü—̓tƒ@ƒCƒ‹–¼ (JPEG,PNG,GIF)
outputfile -> o—̓tƒ@ƒCƒ‹–¼ (JPEG,PNG,GIF)
 
width -> ƒŠƒTƒCƒYŒã‚̉¡px
height -> ƒŠƒTƒCƒYŒã‚̏cpx
 
c‰¡”ä‚ð•Û‘¶‚µ‚½‚Ü‚ÜŠg‘åk¬‚·‚éê‡‚Í
‘æŽOˆø”‚É z ‚Ü‚½‚Í Z ‚ðŽw’肵
‘æŽlˆø”‚É ”{—¦‚ðŽw’肵‚Ü‚·
 
[option]
JPEG‘‚«ž‚݂̏ꍇ JPEGƒNƒIƒŠƒeƒB’l(1-100)‚ð
PNG‘‚«ž‚݂̏ꍇ P –”‚Í p ,
GIF‘‚«ž‚݂̏ꍇ G –”‚Í g ‚ðŽw’肵‚Ü‚·
È—ª‚³‚ꂽê‡‚Í 75 ‘Š“–‚ª•âŠ®‚³‚ê‚Ü‚·
 
ex.
$repng2jpeg 1.jpg 2.jpg 400 300 # 400x300‚ɃŠƒTƒCƒY‚µJPEG(75)‚ŏ‘‚«ž‚Ý
$repng2jpeg 1.jpg 2.jpg 400 300 90 # 400x300‚ɃŠƒTƒCƒY‚µJPEG(90)‚ŏ‘‚«ž‚Ý
$repng2jpeg 1.jpg 2.png 400 300 P # 400x300‚ɃŠƒTƒCƒY‚µPNG‚ŏ‘‚«ž‚Ý
$repng2jpeg 1.jpg 2.gif Z 0.5 G # 0.5”{‚ɃŠƒTƒCƒY‚µGIF‚ŏ‘‚«ž‚Ý
 
---
ˆË‘¶ŠÖŒW‚Æ‚¢‚¤‚©”z•z”ŃoƒCƒiƒŠ‚ÌŽg—p‚·‚郉ƒCƒuƒ‰ƒŠŒQ
static”Å‚Í“Á‚É‹¤—Lƒ‰ƒCƒuƒ‰ƒŠ‚ð•K—v‚Æ‚µ‚Ü‚¹‚ñB
 
i386_freebsd4_dynamic
libjpeg -> libjpeg.so.9
libpng -> libpng.so.5
libz -> libz.so.2
libm -> libm.so.2
libc -> libc.so.4
 
i386_freebsd4_standard
libz -> libz.so.2
libm -> libm.so.2
libc -> libc.so.4
 
i386_linux_dynamic
libjpeg -> libjpeg.so.62
libpng -> libpng.so.2
libz -> libz.so.1
libm -> libm.so.6
libc -> libc.so.6
ld-linux.so.2
 
i386_linux_standard
libz -> libz.so.1
libm -> libm.so.6
libc -> libc.so.6
ld-linux.so.2
 
i386_solaris_standard
libc -> libc.so.1
libdl -> libdl.so.1
 
sparc_solaris_standard
libc -> libc.so.1
libdl -> libdl.so.1
libc_psr.so
 
i386_win32
-> msvcrt.dll
 
--
i386_freebsd4_dynamic SIZE: 59036@/ MD5: a375f3fc944740ca5706f0ea272fb5c0
i386_freebsd4_standard SIZE: 254296 / MD5: ee64f97139cdce1222ec41aa79e32613
i386_freebsd4_static SIZE: 371324 / MD5: 0ff9a08698c08b3898a50f6855cf1ab5
i386_linux_dynamic SIZE: 59556 / MD5: 6f03c0ec02237299cd8f9a9e2212195a
i386_linux_standard SIZE: 252468 / MD5: bf4db47cf12f43939892444da0d1ec98
i386_linux_static SIZE: 661768 / MD5: 63e917c291e4476b0719756dd2df595b
i386_solaris_standard SIZE: 332272 / MD5: 34091fe828658575ef5bdf9e21949816
i386_solaris_static SIZE: 501804 / MD5: 0647c706ab30dc16779e71b3c7b7ae87
sparc_solaris_standard SIZE: 416324 / MD5: d43ce38b0033ff474ec28c9df159c881
sparc_solaris_static SIZE: 643624 / MD5: 27c0e47a8a439126212411d3c8fd0785
i386_win32 SIZE: 153600 / MD5: 043b3c41dd749365b960f1a7320a69ed
 
 
--
ƒRƒ“ƒpƒCƒ‹ŠÂ‹«
Linux -> Vinelinux2.6r4(i386)
FreeBSD -> FreeBSD4.10R(i386)
Solaris -> SunOS5.8(i386/sparc)
Windows -> Windows2000SP4 + MinGW
 
---
1.0.3 -> 1.0.4 GIF‘‚«ž‚݁A”{—¦ƒIƒvƒVƒ‡ƒ“’ljÁ
1.0.2 -> 1.0.3 GIF“ǂݍž‚݃Tƒ|[ƒg
1.0.1 -> 1.0.2 PNG‘‚«ž‚݃Tƒ|[ƒg
1.0.0 -> 1.0.1 JPEG“ǂݍž‚݃Tƒ|[ƒg
1.0.0 png¨jpeg‚̃TƒCƒY‹y‚уtƒH[ƒ}ƒbƒgƒRƒ“ƒo[ƒ^‚Æ‚µ‚č쐬
New file
/repng2jpeg/mk-repng2jpeg.bat
@@ -0,0 +1 @@
gcc -Os -momit-leaf-frame-pointer -I. -DNONDLL=1 repng2jpeg.c libbgd-static.a -lstdc++ -lgdi32 -Wl,-Bstatic -lpng -lz -ljpeg -Wl,-Bdynamic -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -s -o repng2jpeg
New file
/repng2jpeg/repng2jpeg.c
@@ -0,0 +1,123 @@
// 15:00 2004/08/05
#include "gd.h"
#include <stdio.h>
#include <stdlib.h> /* for atoi(),atof() */
#include <string.h>
#define VER "1.0.4"
 
int main(int argc, char *argv[]) {
 
gdImagePtr dst,src;
FILE *imgin,*imgout;
int dstW,dstH,srcW,srcH,jpegq,imgouttype;
double ratio;
unsigned char num[4];
 
if (argc >= 2 && (strcmp(argv[1],"--v") == 0 || strcmp(argv[1],"--ver") == 0 || strcmp(argv[1],"--version") == 0)){
fprintf(stdout,"repng2jpeg version %s\n",VER);
return 0;
}
 
if (argc >= 2 && strcmp(argv[1],"--test") == 0){
fprintf(stdout,"repng2jpeg TestMode:OK version %s\n",VER);
return 0;
}
 
if (argc >= 2 && strcmp(argv[1],"--help") == 0){
fprintf(stdout,"usage: repng2jpeg inputfile outputfile (width height|Z ratio) [Quality|P|G]\n\ninput JPEG,PNG,GIF\noutput JPEG,PNG,GIF\n\n[option]\n Quality Set the JPEG Quality (1-100 or Default.75)\n P or p Output a PNG image\n G or g Output a GIF image\n\nex.\nrepng2jpeg 1.jpg 2.jpg 400 300\nrepng2jpeg 1.jpg 2.jpg 400 300 90\nrepng2jpeg 1.jpg 2.png 400 300 P\nrepng2jpeg 1.jpg 2.gif Z 0.5 G\n\n",VER);
return 0;
}
if (argc <= 4){
fprintf(stderr,"repng2jpeg: missing file argument\nTry `repng2jpeg --help' for more information.\n");
return 1;
}
 
if(!(imgin = fopen(argv[1],"rb"))) {
fprintf(stderr,"%s open error!\n",argv[1]);
return 2;
}
 
fread(num,1,4,imgin);
fseek(imgin,0,0);
 
if (num[0] == 0x89 && num[1] == 0x50 && num[2] == 0x4e && num[3] == 0x47){
src = gdImageCreateFromPng(imgin);
}else if (num[0] == 0xff && num[1] == 0xd8){
src = gdImageCreateFromJpeg(imgin);
}else if (num[0] == 0x47 && num[1] == 0x49 && num[2] == 0x46){
src = gdImageCreateFromGif(imgin);
}else{
fprintf(stderr,"Input is not in JPEG PNG or GIF format!\n");
return 3;
}
 
fclose(imgin);
 
if(!src){
fprintf(stderr,"Not Read Image!\n");
return 4;
}
 
srcW = src->sx;
srcH = src->sy;
 
if(strcmp(argv[3],"Z") == 0||strcmp(argv[3],"z") == 0){
ratio = atof(argv[4]);
dstW = srcW * ratio;
dstH = srcH * ratio;
 
}else{
dstW = atoi(argv[3]);
dstH = atoi(argv[4]);
}
 
jpegq = 0;
imgouttype = 0;
 
if(argc > 5){
if(strcmp(argv[5],"P") == 0||strcmp(argv[5],"p") == 0){ imgouttype = 2; }
else if(strcmp(argv[5],"G") == 0||strcmp(argv[5],"g") == 0){ imgouttype = 3; }
else{ jpegq = atoi(argv[5]); imgouttype = 1; }
}else{
imgouttype = 1;
}
 
/*
if(dstW < 1||dstH < 1||dstW > 5000 ||dstH > 5000){
fprintf(stderr,"Max Width or Height -> 5000px\n");
gdImageDestroy(src);
return 5;
}
*/
if(jpegq < 1||jpegq > 100){ jpegq = 75; }
 
// gd1 non Antialias
// dst = gdImageCreate(dstW, dstH);
// gdImageCopyResized(dst, src, 0, 0, 0, 0, dstW, dstH, srcW, srcH);
 
// gd2 Antialias
dst = gdImageCreateTrueColor(dstW, dstH);
gdImageCopyResampled(dst, src, 0, 0, 0, 0, dstW, dstH, srcW, srcH);
 
gdImageDestroy(src);
 
if(!(imgout = fopen(argv[2], "wb"))) {
fprintf(stderr,"%s open error!\n", argv[2]);
gdImageDestroy(dst);
return 6;
}
 
if(imgouttype == 1){
gdImageJpeg(dst,imgout,jpegq);
}else if(imgouttype == 2){
gdImagePng(dst,imgout);
}else if(imgouttype == 3){
gdImageGif(dst,imgout);
}
 
fclose(imgout);
gdImageDestroy(dst);
 
return 0;
}