![]() ![]() Print("The width of the image is: ", width) Print("The height of the image is: ", height) If filename.endswith(".jpg") or filename.endswith(".png"):įilepath = 'C:\\Users\\suppo\\Pictures\\testing\\' + filename OutWorkbook = xlsxwriter.Workbook("Testing Excel Python v1.xlsx")įor file_index, filename in enumerate(os.listdir(directory)): Print('Total Number of directories',totalDir) Print('Total number of files',totalFiles) Not bad for only downloading Python and starting out with "Hello world!" about 3 hours ago! import osĭirectory = "C:\\Users\\suppo\\Pictures\\testing"ĪPP_FOLDER = "C:\\Users\\suppo\\Pictures\\testing"įor base, dirs, files in os.walk(APP_FOLDER): Then the whole thing would just loop over all images in the folder, and the row that it would write the outputs to would correspond to the current step in the Loop process - with the number of times it would run through the loop obviously corresponding to the number of files in the given folder.Įnded up writing a Python script to accomplish this. Then instead of displaying the outputs as an alert message, ideally it would instead write these outputs onto the respective cells of an Excel spreadsheet whose filepath would be provided somewhere in here. Seems to be a step in the right direction however: using (Image img = ("C:\Users\suppo\Pictures\testing\this-is-a-test-product-image-1.jpg"))Īlert("Current width=" + width + ", " + "Original height=" + height) I found an online resource recommending something like this (most cover images via URLs - not filepaths), however I haven't had luck with successfully executing this. If you could go above and beyond and just supply me with a template program that would accomplish this - with a template image folder that I could then substitute with my filepath, and also a template Excel filepath that I could replace with the one I would use (a sort of // SUBSTITUTE YOUR IMAGE FOLDER FILEPATH HERE type deal) - that would be downright amazing! Even just some scraps to get me going would be super helpful. I'm a complete noob when it comes to Javascript etc. Etc until completion.Īny ideas on the simplest way that I could do this with some sort of computer program? It could be Javascript, really anything that I'd be able to easily execute on my local computer. Image 2's information would then be written to A2 + B2. image height in pixels written to cell A1, image width in pixels written to B2. Since it would loop over all images in a folder, it would need to write the image data for Image 1 in the folder to Row 1, e.g. So I basically need to use some fast & effective external method of gathering this image data - and then the simplest way for me to be able to pick it up would be just to write this info to an Excel spreadsheet. However for whatever reason they don't have a function to get image properties (such as image height and width), and then store that information for later use as a variable. The full process here will basically automate the function of evaluating image dimensions to determine what standard image formats they are closest to, and then folderize them accordingly.Īll of these later steps, I will do inside of PowerAutomate - simply because I'm very comfortable working inside of there and could easily accomplish the rest of this process using PowerAutomate. Those whose dimensions are closest to the 3:2 dimensions would be sent to that folder. The full process would do this for all images in a folder.įor full context of what is happening here: This information is ultimately going to be used to make decisions in the full workflow about what folders to send these images to based upon their dimensions.įor example : images whose dimensions are very close to a square 1:1 would be sent to the "SQUARE" folder. I'm trying to supply a filepath to an image on my computer, extract the image height and width in pixels, then output those numbers for later use - ideally into an Excel Spreadsheet. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |