How to create a bulk photo editing tool
Create a bulk photo editor to resize, convert and compress an unlimited number of images:
Tools used to create this software:
Click the code below to copy it:
on load("Bot Loaded") {
plugin command("Data and Files Automation.dll", "Data and Files Automation", "INSERT LICENSE KEY")
plugin command("Image Automation.dll", "Image Automation Set License", "INSERT LICENSE KEY")
set(#input_folder,"INSERT DEFAULT PATH FOR INPUT FOLDER","Global")
set(#output_folder,"INSERT DEFAULT PATH FOR INPUT FOLDER","Global")
}
ui text box("max width (pixels)",#max_width)
ui text box("max height (pixels)",#max_height)
ui text box("max output image size (KB)",#max_file_size)
ui button("convert all to jpg") {
read list of images from input folder()
convert all to jpg()
}
ui button("resize all") {
read list of images from input folder()
resize all images()
}
ui button("compress all") {
read list of images from input folder()
compress all()
}
ui text box("input folder path",#input_folder)
ui text box("output folder path",#output_folder)
define read list of images from input folder {
clear list(%input_images)
add list to list(%input_images,$list from text($plugin function("Data and Files Automation.dll", "$get files 2", #input_folder, "*.jpg,*.jpeg,*.png,*.bmp,*.gif,*.webp", "False", "Root Directory Only"),$new line),"Delete","Global")
}
define convert all to jpg {
set(#work_counter,0,"Global")
set(#amount_of_images,$list total(%input_images),"Global")
loop while($comparison(#work_counter,"< Less than",#amount_of_images)) {
plugin command("Image Automation.dll", "image converter", "{#input_folder}\\{$list item(%input_images,#work_counter)}", "{#output_folder}\\{$list item(%input_images,#work_counter)}", 128, 90)
increment(#work_counter)
}
}
define resize all images {
set(#work_counter,0,"Global")
set(#amount_of_images,$list total(%input_images),"Global")
loop while($comparison(#work_counter,"< Less than",#amount_of_images)) {
plugin command("Image Automation.dll", "image resize", "{#input_folder}\\{$list item(%input_images,#work_counter)}", "{#output_folder}\\{$list item(%input_images,#work_counter)}", "Preserve Aspect Ratio", "{#max_width} x {#max_height}", 000000)
increment(#work_counter)
}
}
define compress all {
set(#work_counter,0,"Global")
set(#amount_of_images,$list total(%input_images),"Global")
loop while($comparison(#work_counter,"< Less than",#amount_of_images)) {
plugin command("Image Automation.dll", "image reduce file size", "{#input_folder}\\{$list item(%input_images,#work_counter)}", "{#output_folder}\\{$list item(%input_images,#work_counter)}", #max_file_size, "Image Size")
increment(#work_counter)
}
}