I did a project last year in VB for image processing, basically link to a folder, load an overlay and loop through the folder overlaying a watermark. I now need to get the same thing running in python to cater for cross platform use.

I have translated all the image processing code so I have a function written and working for a single image eg.

watermark(image input, overlay1, overlay2 )

but I need to loop it through a folder of images and am a bit stuck.

I also need to come up with a simple 3 button GUI. specify the folder, load the first overlay and load the second overlay. Hopefully like VB open file dialog.

Snippets would be helpful, but im mainly here to learn so any good explaination or links is much appreciated. I have done a google of it all but comes up with so much to sift through (for GUI at least) that I have no idea where to start.

Thanks in advance,
Rich

Recommended Answers

All 3 Replies

VB.NET and IronPython can be easily converted to and from eachother because they both run on the CLI.

You would use System.Windows.Forms for both in order to make gui, for example.

I don't know about just VB.

Here's what I'm using to scan through a folder and read the sub-folders (and eventually files in the folder). I'm a Python beginner but maybe it will give you an idea.

os.chdir(sequence_folder)           #change to the sequence folder
    data_folders = sorted(glob.glob('*.d'))      #Get a sorted list of data folders in the sequence

    for folder in data_folders:              #loop through each folder name in list
        sample_folder = sequence_folder + '\\' + folder   #form a pathname string
        os.chdir(sample_folder)         #Change to the sample folder
    
        try:
            csv_files = glob.glob('*.csv')      #get list of csv files in folder - should be just 2
            csv_header = sample_folder + '\\' + csv_files[0]    #first is header information
            csv_data = sample_folder + '\\' + csv_files[1]      #second is data
#           print(csv_data)
        except:     # two csv files not found
            continue

You would use System.Windows.Forms for both in order to make gui, for example.

Apologies, I should have mentioned I'm on a Linux box for this project.

Thanks for that snippet mattj63, I'll have a go at pulling it apart and getting it to perform on my folders of .jpeg files.

Anyone know how I could get a link to folder input for the file path? either get the terminal to take a typed input or get an open file window? Just a temp to test before I jump on my GUI problem.

Thanks again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.