Discord Server Twitter Donation Youtube Google+
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Project Resizing Mulitple Images at Once [Java]
Big Grin 
In The Name OF Allah
Al-Salam Alekum

A script for resizing images in Java:

PHP Code:
import java.awt.image.*;
import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

 * @author LOL
public class ImageTest {

    private static final int IMG_WIDTH 42;
    private static final int IMG_HEIGHT 42;
static void main(String [] args){
            File folder = new File("Location of the folder");
            File[] listOfFiles folder.listFiles();

            for (int i 0listOfFiles.lengthi++) {
                if (listOfFiles[i].isFile()) {
                    BufferedImage img 
                    int type img.getType() == 0BufferedImage.TYPE_INT_ARGB img.getType();
                    BufferedImage resizeImagePng resizeImage(imgtype);
                    ImageIO.write(resizeImagePng"png", new File("c:\\image\\" listOfFiles[i].getName()));
        }catch(IOException e){
private static BufferedImage resizeImage(BufferedImage originalImageint type){
    BufferedImage resizedImage = new BufferedImage(IMG_WIDTHIMG_HEIGHTtype);
    Graphics2D g resizedImage.createGraphics();
    return resizedImage
private static BufferedImage resizeImageWithHint(BufferedImage originalImageint type){
    BufferedImage resizedImage 
= new BufferedImage(IMG_WIDTHIMG_HEIGHTtype);
    Graphics2D g resizedImage.createGraphics();

    return resizedImage

Wa Salam Alekum

[Image: 4Kxb0N1.gif]
We Are Anonymous, We Are Legion, We Do not Forgive, We do not Forget
Expect Us

Users browsing this thread: 1 Guest(s)