Idris Kadri
Front & Back End Developer & Animator

Automated Thumbnail Creator

Github

Languages & Tools: Java, JavaFX

Turns a list of images and text into thumbnails. Mainly used for product images or youtube thumbnails.


Sample Code



	

ReadVideoInfo readVideoInfo = new ReadVideoInfo();

public void start(Stage primaryStage) throws Exception {

readVideoInfo.read("files/pokemonInfo.csv");
count = 0;
length = readVideoInfo.pokemonNo.size();

while(count < length) {

try {
fileName = readVideoInfo.pokemonNo.get(count);
img = readVideoInfo.pokemonNo.get(count) + ".png";
name = readVideoInfo.name.get(count);

if (!new File("files/youtubeImgs/" + fileName + ".png").exists() && !img.contains("2b")) {

if(img.contains("jpg") || img.contains("png")) {
//System.out.println("img : " + img);
window = primaryStage;
window.setTitle("Thumbnail Image");

mainPane = new Pane();
mainPane.setStyle("-fx-background-color: white;");

setBgImage();
setPokemonImage();


//mainPane.getChildren().add(productImage);
mainPane.getChildren().add(backgroundImage);
mainPane.getChildren().add(pokemonImage);
mainPane.getChildren().add(pokemonName);

setScene(false);
render();
//Thread.sleep(1000);
}

}

}catch (Exception e){
System.out.println("Failed...");
}
count++;
}

System.out.println("Complete");
System.exit(0);
Platform.exit();
}


void setBgImage(){
bgNo = (int)(Math.random() * 8 + 1);

Image image = new Image("file:" + "files/bg/thumbnail.png");
backgroundImage = new ImageView(image);
//backgroundImage.setFitHeight(735);

}

void setPokemonImage(){

Image image = new Image("file:" + "files/pokemonImages/" + img);
pokemonImage = new ImageView(image);
pokemonImage.setPreserveRatio(true);
pokemonImage.setFitWidth(650);
pokemonImage.setTranslateX(580);
pokemonImage.setTranslateY(50);

pokemonName = new Label(name.toUpperCase());
pokemonName.setFont(new Font(100));
pokemonName.setTranslateX(0);
pokemonName.setPadding(new Insets(0,60,0,30));
pokemonName.setTranslateY(500);
pokemonName.setStyle("-fx-background-color: #465ffa; -fx-font-weight: bold; -fx-text-fill: white");

}

Back