我有10,000张照片需要调整大小,所以我有一个Java程序来做.不幸的是,图像的质量很差,我无法访问未压缩的图像.
import java.awt.Graphics;
import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
* This class will resize all the images in a given folder
* @author
*
*/
public class JavaImageResizer {
public static void main(String[] args) throws IOException {
File folder = new File("/Users/me/Desktop/images/");
File[] listOfFiles = folder.listFiles();
System.out.println("Total No of Files:"+listOfFiles.length);
BufferedImage img = null;
BufferedImage tempPNG = null;
BufferedImage tempJPG = null;
File newFilePNG = null;
File newFileJPG = …Run Code Online (Sandbox Code Playgroud) 我试图从正在解析的命令行中找出,哪个函数最好将十进制,十六进制或八进制数转换int为最佳数 - 不事先知道输入.
然后,目标是使用单个函数来识别不同类型的输入并将其分配给它的integer(int)值,然后可以使用它:
./a.out 23 0xC4 070
Run Code Online (Sandbox Code Playgroud)
可以打印
23
196 /*hexadecimal*/
56 /*octal*/
Run Code Online (Sandbox Code Playgroud)
我能看到的唯一问题是解析找到十进制整数和八进制之间的差异.
边题,是否可以将字符串转换为整数使用?
我在c中编写了一个二叉搜索树,并且在我的函数的开头和头文件中的'*'token'消息之前我一直得到愚蠢的"错误:预期')''
主文件
#include <stdlib.h>
#include <stdio.h>
#include "func.h"
#define ARRAYSIZE 12
int main(int argc, char *argv[3]) {
typedef struct node {
int value;
struct node * left;
struct node * right;
} * node;
node* root = NULL;
int nodes[ARRAYSIZE] = {3,6,2,1,7,8,3,5,7,2,9,4};
int i;
for(i = 0; i < ARRAYSIZE; i++) {
root = insert(root, nodes[i]);
}
if (strcmp(argv[1], "q") == 0) quit();
if (strcmp(argv[1], "i") == 0) insert(argv[2]);
if (strcmp(argv[1], "d") == 0) delete(argv[2]);
if (strcmp(argv[1], "s") == 0) …Run Code Online (Sandbox Code Playgroud)