Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 566 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Resizing Mulitple Images at Once [Java]

#1
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;
    
    public static 
void main(String [] args){
        
    try{
            
File folder = new File("Location of the folder");
            
File[] listOfFiles folder.listFiles();

            for (
int i 0listOfFiles.lengthi++) {
                if (
listOfFiles[i].isFile()) {
        
                    
BufferedImage img ImageIO.read(listOfFiles[i]);
                    
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){
        
System.out.println(e.getMessage());
    }
    
        
        
        
    }
    
    private static 
BufferedImage resizeImage(BufferedImage originalImageint type){
    
BufferedImage resizedImage = new BufferedImage(IMG_WIDTHIMG_HEIGHTtype);
    
Graphics2D g resizedImage.createGraphics();
    
g.drawImage(originalImage00IMG_WIDTHIMG_HEIGHTnull);
    
g.dispose();
        
    return 
resizedImage;
    }
    
    private static 
BufferedImage resizeImageWithHint(BufferedImage originalImageint type){
        
    
BufferedImage resizedImage = new BufferedImage(IMG_WIDTHIMG_HEIGHTtype);
    
Graphics2D g resizedImage.createGraphics();
    
g.drawImage(originalImage00IMG_WIDTHIMG_HEIGHTnull);
    
g.dispose();    
    
g.setComposite(AlphaComposite.Src);

    
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
    
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    
g.setRenderingHint(RenderingHints.KEY_RENDERING,
    
RenderingHints.VALUE_RENDER_QUALITY);
    
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    
RenderingHints.VALUE_ANTIALIAS_ON);
    
    return 
resizedImage;
    }    



Wa Salam Alekum
Reply

#2
Nice share my friend. Not really a fan of Java but usefull to know. Did you code this yourself?
Reply

#3
Quote:(03-19-2018, 08:47 AM)Bish0pQ Wrote:

[To see links please register here]

Nice share my friend. Not really a fan of Java but usefull to know. Did you code this yourself?
Thank you my friend.
This script was for resizing an image but I edited it to resize multiple images at once.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through