I want to read all the images in a folder using Java.
When: I press a button in the Java application,
It should:
- ask for the directory’s path in a popup,
- then load all the images from this directory,
- then display their names, dimension types and size.
How to proceed?
I have the code for read the image and also for all image in the folder but how the things i told above can be done?
Any suggestion or help is welcome! Please provide reference links!
Untested because not on a machine with a JDK installed, so bear with me, that’s all typed-in “as-is”, but should get you started (expect a rush of downvotes…)
Loading all the Images from a Folder
APIs Used
This is relatively simple to do and uses only standard JDK-packaged classes:
FileFilenameFilterBufferedImageImageIOThese sessions of the Java Tutorial might help you as well:
Possible Enhancements
FilenameUtilsto extract files’ extensionsFileChooserto select the folder.By combining all of the above, it’s pretty easy to do.