Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Mass load images
I am trying to see if it is possible to import images in mass related to a field. Let me explain:

In Microsoft access I have a calculation field with this link to a folder that holds 715 movie poster images: C:\\Users\pe\Pictures\Photos\" & [Title] & ".jpg"

As you can see I can mass load all my pictures to the correct record by using the field "Title".

I have been interested in using Python 3 and Tkinter to build a front end to a SQLite database. Is it possible to bring in all the images in one import from a SQLite database relating to a field in my GUI for those records?

I see many tutorials how to embed or reference one image but not any importing images in mass based on an identifying field. Hope this makes sense. Thank you.
How did the images get into the SQLite3 database?
what does the .schema look like?
What does the GUI look like?
Please explain all in a way the can clearly be understood.
import only loads a library into python, it's not used to load images.
you can however load an entire directory of images into an intermediate list thusly:
This code is untested, but should work. You can change the suffix clause or eliminate it entirely if you have mixed image types
import pathlib
import os

#Anchor CWD to script directory

# You can change path below, relative paths (from script directory) are OK.
path_to_images = Path('./images')
image_list = []

images = [imagex for imagex in path_to_images.iterdir() if imagex.is_file() and imagex.suffix== '.png']
for image in images:
    with as fp:
This creates a list of images. You can modify code to directly load then into tkinter.
Please note that this could get very memory intensive, depending on size of images, so should only be done this way if you have enough memory to hold all images.
Also note that pathlib requires python 3.6 or newer

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Change of mass hexa data kosteloos 0 114 Aug-12-2019, 10:04 AM
Last Post: kosteloos
  mass rename files in folders kerzol81 5 4,369 Dec-29-2017, 09:08 PM
Last Post: wavic

Forum Jump:

Users browsing this thread: 1 Guest(s)