PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, May 6, 2022

[FIXED] How to extract elements of a list into a folder in Python

 May 06, 2022     directory, image, list     No comments   

Issue

I have a list of image objects. I want to build a folder comprising the images of this list, so that I can download the folder. Is there a way to do this?


Solution

The PIL Image object has a save function that you can make use of.

Simply loop over each Image object and call the save function and provide it with the path of the image.

Example:

for i, img in enumerate(list_of_imgs):
    img.save(f"{dir}/{i}.jpg")


Answered By - Tharun K
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing