Python Tutorial: Image Manipulation with Pillow

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 241

  • @Lavamar
    @Lavamar 6 років тому +180

    I think you make the best python tutorials on UA-cam.

    • @emmanuelmtera5936
      @emmanuelmtera5936 5 років тому +1

      umepata ufunuo, i think you should make a class on python for android apps

    • @yuzhenwang8103
      @yuzhenwang8103 5 років тому +2

      I think so. better than most I've watched

    • @veitkoch3784
      @veitkoch3784 4 роки тому

      @@emmanuelmtera5936 Lakini amepata ile ufunuo kutoka wapi?

    • @emmanuelmtera5936
      @emmanuelmtera5936 4 роки тому

      @@veitkoch3784 well i dont know, but he teaches well

    • @veitkoch3784
      @veitkoch3784 4 роки тому +1

      @@emmanuelmtera5936 Na kweli, anaeleza safi kabisa. Ana sauti nzuri pia.

  • @Gigolas88
    @Gigolas88 5 років тому +10

    4 years later and it's still relevant. Thanks alot!

  • @user-ph2bc8kc6c
    @user-ph2bc8kc6c 5 років тому +9

    I just love the super detailed explanations accompanied by writing the code. Really amazing work here Corey and I hope you'll make more videos about Python libraries and common misunderstanding developers have. Big thank you!

  • @krisbaek
    @krisbaek 5 років тому +113

    Came for Python stayed for the puppy

    • @Gamer0127
      @Gamer0127 4 роки тому +2

      I was scrolling to the comments about to type the same exact sentence

  • @VasuDeo.S-dt4ts
    @VasuDeo.S-dt4ts 6 років тому +13

    Awesome Video. Just a little rectification. The "L" mode that you used for converting your image into black and white, is actually for converting an image into greyscale. A black and white image only consists of 2 colors (Black & White) and the image that you converted had several shades of grey(0-255).
    For Converting an image into black and white you have to use "1" mode which stands for 1 bit per pixel which truly resembles a Black & White image, use that in disabled dither mode to actually see the black and white image otherwise you will see you image with grainy noise.
    You can sort of see this just by looking at the image, a black and white image should just contain black and white not any other color.

  • @ksrajavel
    @ksrajavel 4 роки тому +5

    My mindvoice : What in Python does Corey Schafer doesn't know?
    Best Python instructor on UA-cam.
    Hope you can start some Udemy courses, Corey. People will be flocking towards your course.

  • @ahmed634899
    @ahmed634899 6 років тому +11

    I would like to thank you from the bottom of my heart for this tutorial

  • @georgesd9
    @georgesd9 4 роки тому +1

    So this is what I do, I open one of Corey’s tutorials, hit like, then watch the video, thank you Corey for the great content you are providing, much appreciated

  • @lydiafritz5674
    @lydiafritz5674 2 роки тому +2

    Excellent. Your pacing is terrific - direct and to the point.

  • @hacninetushar
    @hacninetushar 3 роки тому

    Searched 'Pillow Module' tutorial, Got favorite youtuber's channel. Thanks a lot.

  • @ednawatirainarli720
    @ednawatirainarli720 5 років тому +6

    thanks God, I found your channel. Actually, I'm a beginner in python. Your explanation is simple and understandable. Thank you

  • @smolboislayer8339
    @smolboislayer8339 3 роки тому

    Best python tutorial on UA-cam. You are simply amazing 😀

  • @lightninginmyhands4878
    @lightninginmyhands4878 5 років тому +14

    You will be a legend in Python history.

  • @scorpy1971
    @scorpy1971 3 роки тому

    Fantastic. Crisp. Clear. Precise. Thank you!!

  • @arceniocornejo6779
    @arceniocornejo6779 6 років тому +9

    Simple and straight to the point. Thanks.

  • @YeekyYeeky
    @YeekyYeeky 2 роки тому

    when I want to find some good knowledge about some python topic , the first thing i do is to find if Corey has it in his channel . so good

  • @user-pt4vn5hr2z
    @user-pt4vn5hr2z 5 років тому +1

    Cory, i love your videos. it help me a lot with my projects. in a few months i learned python.

  • @salarghaffarian4914
    @salarghaffarian4914 4 роки тому

    You are the best instructor! Thanks for your valuable videos.

  • @asmadja51
    @asmadja51 2 роки тому

    you have the blood of a genius! thank you man!

  • @SoSo11
    @SoSo11 9 місяців тому

    Straight forward and well explained
    Amazing video 👍👍

  • @Bangjamal
    @Bangjamal Місяць тому

    very informative video buddy highly appreciat your work

  • @asma-pe3rx
    @asma-pe3rx 6 років тому +2

    The best python teacher...

  • @lydiafritz5674
    @lydiafritz5674 2 роки тому

    Oh - and packed with terrific information.

  • @rpattnaik2000
    @rpattnaik2000 6 років тому +4

    Very Very helpful videos man .... Keep them coming :)

  • @edchelstephens
    @edchelstephens 2 роки тому

    Excellent tutorial! Thanks Corey!🙏

  • @heshankumarasinghe3159
    @heshankumarasinghe3159 4 роки тому +1

    Thank you for the video..... This vid is entertaining and helpful at the same time......

  • @EduardoAndreePS
    @EduardoAndreePS Рік тому

    All your videos are amazing, thank you for making content like this!

  • @GeorgeFoxRules
    @GeorgeFoxRules Рік тому

    You are very good teacher by the way

  • @gnypp45
    @gnypp45 5 років тому +1

    A great video for me to get started with this library. Thanks!

  • @MatthewStidham
    @MatthewStidham 5 років тому +4

    Super helpful, thank you!

  • @michaelmoore7568
    @michaelmoore7568 2 роки тому

    good sir. Your videos are a gift from god

  • @tonyt3336
    @tonyt3336 6 років тому +4

    Excellent tutorial! Thank you!

  • @Heloin42
    @Heloin42 6 років тому +9

    fantastic tutorial, thank you!

  • @RandomShowerThoughts
    @RandomShowerThoughts 6 років тому +7

    its incredible how python makes our lives so much easier lol

  • @df6148
    @df6148 5 років тому

    I like it. Going to have to learn more about the OS feature and how to loop through files and such without destroying my own directories lol but this looks like exactly what I will use when I have a better understanding of how that part works. Thank you

    • @coreyms
      @coreyms  5 років тому +1

      I have a video on the OS module as well if you'd like to learn more about that in-depth. You can search for it on my channel

    • @df6148
      @df6148 5 років тому

      @@coreyms Awesome Thanks a lot!

  • @xingnanzhou8628
    @xingnanzhou8628 4 роки тому

    thanks for sharing this. really help me learn the basic idea of coding!

  • @maheshrenganathan2127
    @maheshrenganathan2127 5 років тому +5

    Dear Corey Schafer, Thanks a lot for all of your Python tutorials. I am basically from science background, however, i am able to do python code in data analytics field. You are just amazing in teaching those. Then, I request you to make one video about HyperSpy and spectral python package's application.

  • @richardfinney2548
    @richardfinney2548 6 років тому +4

    Thank you so much!!! Awesome tutorial and very much appreciated :)

  • @abrahamofek4485
    @abrahamofek4485 3 роки тому

    Very very helpful, thank you very much !!!

  • @bilalshah8989
    @bilalshah8989 4 роки тому

    You explained each and every thing very well

  • @hubertcombomarketing2693
    @hubertcombomarketing2693 4 роки тому +1

    Good as always. Thanks.

  • @anwarroba6574
    @anwarroba6574 7 років тому +3

    Clear and precise!
    thank you

  • @DANJUMA9
    @DANJUMA9 8 років тому +1

    Awesome, was looking for this. Thanks.

  • @sapkotanischal1054
    @sapkotanischal1054 4 роки тому +1

    thanks brother, a lot
    of information :)

  • @krucy22
    @krucy22 6 років тому

    Really simple. easy to understand. Thanks a lot!

  • @nulluser0
    @nulluser0 5 років тому +1

    great tutorial, and i've seen many. cheers!

  • @bradchen9317
    @bradchen9317 3 роки тому

    this is an excellent tutorial!

  • @HaguDeGozaru
    @HaguDeGozaru 8 років тому +1

    Thanks for this concise demonstration.

  • @queensofthedthrone8267
    @queensofthedthrone8267 8 років тому

    How are you running your command? Each time you do it you click off-screen and bang, the program works! I have to terminal each and every time.
    It seems like you're using Sublime Text, or something formateed very similar. Very interseted in this answer and in watching more of your videos because...this one was the best programming video I've ever seen yet.

    • @coreyms
      @coreyms  8 років тому

      Hey there. I'm not clicking off screen, I'm just pressing Cmd+b. That is how you run code within Sublime Text. There are several other ways we could execute it via the terminal, but this is how I usually do it in my videos. Thanks for the question.

    • @donsanjino
      @donsanjino 7 років тому

      I'm using pycharm. It similarly uses Cmd+r to execute code.
      If you have to use terminal every time, you can maybe try out pycharm. There are two free versions: community (PC), and Education (PE).

  • @eziola
    @eziola 12 днів тому

    Great video Corey! Could you do a video on shutil next? 😊

  • @jonathanarias2729
    @jonathanarias2729 3 роки тому

    great! a great image editor!

  • @qwe123727
    @qwe123727 7 років тому

    Corey, I wish you could talk about byte datatype and its usage at low level stuff(like windows/unix files). I think, your intro stuf with this series will avoid me reading "dive into python" book

  • @Polydipsic21
    @Polydipsic21 2 роки тому +5

    Corey not only knows how to make python tutorials fun to watch, he also singles out all the best tools a python programmer ever needs. I'm proud to live in an era in which I can watch guys like him. Good job bro. ☫

  • @rahulrjb
    @rahulrjb 3 роки тому

    warning this in 2021, in the midst of a pandemic. who would have thought!

  • @anilgupta-dy1oj
    @anilgupta-dy1oj 6 років тому +2

    thanks a lot , this is very helpful videos.

  • @lukabotic
    @lukabotic 4 роки тому +1

    Thanks and you have a fine looking dog, and Im usually a cat fan

  • @saidalkharusi7824
    @saidalkharusi7824 4 роки тому +1

    Thank you, sir!

  • @slimyelow
    @slimyelow 5 років тому +2

    great intro Thanks !

  • @SamoanKiwi
    @SamoanKiwi 3 роки тому

    bro youve helped me so much. Cheers

  • @frclasso
    @frclasso 5 років тому +2

    Amazing video

  • @BarziniNwa
    @BarziniNwa 2 роки тому

    8:23 you had a chance to make a joke about the spartans

  • @jonasjeron1475
    @jonasjeron1475 4 роки тому +1

    THANK YOU A LOT!

  • @jbGraphics_
    @jbGraphics_ 7 років тому

    Excellent tutorial, very clear. Thank you +

  • @Skaxarrat
    @Skaxarrat 7 років тому

    Nice video. Extra points for dogs. Subscribed and Bookmarked :)

  • @silviocesarmartins
    @silviocesarmartins 4 роки тому +1

    Fantastic lib.

  • @Dennis-gg9yv
    @Dennis-gg9yv 5 років тому +1

    I used pip install and it's worked without any problem lol

  • @therabidpancake1
    @therabidpancake1 5 років тому

    I am very appreciative that you are doing a tutorial on this but I am pretty sure you can do this without using other libraries. I could be wrong .

  • @durjaysaha5047
    @durjaysaha5047 2 роки тому

    Thanks a Lot, Bro.

  • @JordanMQ25
    @JordanMQ25 6 років тому

    I line for line have the exact same code and it will crop the image, but only along one axis. Original was 1024x768. New image is 300x200

  • @nimrataneem9182
    @nimrataneem9182 4 роки тому

    This is one of the best tutorials i came across and explanations are also very clear!
    I have a small problem though cuz when i tried to do the reverse, that is, convert png to jpg it wasn't working and was showing error. how to i solve that?

  • @ryanbell5213
    @ryanbell5213 4 роки тому +1

    Great content. +1 Subscriber

  • @dougsmith5873
    @dougsmith5873 7 років тому

    Good video. Very handsome puppy.

  • @sheebastanley3553
    @sheebastanley3553 4 роки тому +3

    when you added size_700, how did you change all three 300s at the same time?

    • @Infusca
      @Infusca 3 роки тому

      I am wondering the same thing

    • @osiris1102
      @osiris1102 3 роки тому

      Press alt while selecting

  • @MasayoMusic
    @MasayoMusic 8 років тому

    Thanks. very interesting video.

  • @hanyanglee9018
    @hanyanglee9018 4 роки тому

    8:26 and this folder will hold all The 300 Spartans.

  • @sameenashaikh_29
    @sameenashaikh_29 6 років тому

    Hi,
    Can you do a video on using piexif library for images to geotag gps data to the images through python programming. Would really appreciate that. Your videos are clear and easy to understand.

  • @bjmaynard01
    @bjmaynard01 8 місяців тому

    Hey, not sure if you get these, but I would love for you to breakdown how to read documentation

  • @janantoninkolar2944
    @janantoninkolar2944 6 років тому +1

    Thank you!

  • @borgyoh
    @borgyoh 5 років тому +2

    i keep getting a file not found error. i copy the direct path in my mac and the image still doesnt show up. help!

  • @iamgroot1328
    @iamgroot1328 2 роки тому +1

    I want to know how to open images which are in different directories
    C// dell /users like that it didn't work for me

  • @malcolmvanorder5453
    @malcolmvanorder5453 5 років тому

    I know it's out of scope for this video, but if someone were using windows and duplicated your steps exactly, the "/" wouldn't be correct. Since you've already imported os, you can use os.path.join() as a platform agnostic way of building the path to the files.

  • @walass907
    @walass907 8 років тому

    very good video ! thx

  • @GerhardAEUhlhorn
    @GerhardAEUhlhorn 5 років тому +2

    At the end: It’s not need to close and reopen the image. Preview is able to update an opened image. ;-)

  • @iqbalhonnur4451
    @iqbalhonnur4451 3 роки тому

    Nice tutorial, is there a way to highlight only certain words in pillow?

  • @olehdiatlenko4463
    @olehdiatlenko4463 7 років тому

    I guess it comes handy to make pics smaller. But rotation or color changing much better do with js on frontend part.

    • @coreyms
      @coreyms  7 років тому

      That may be true, but I would argue there are use cases for modifying images in this way outside the context of a website.

    • @128Gigabytes
      @128Gigabytes 7 років тому

      Hey Corey is it possible to create new images using PIL instead of just editing?

  • @hadleytaylor6950
    @hadleytaylor6950 4 роки тому

    At around the 6:25 point in the video I get
    """
    fname, fext = os.path.splittext(f)
    AttributeError: module 'ntpath' has no attribute 'splittext'
    """
    In the shell window. Any ideas on what I have missed?

  • @hailyslone7817
    @hailyslone7817 3 роки тому

    Do you know why an image would have missing pixels when using PIL? and how I could fix this? thanks!!

  • @pavanbavirisetty9724
    @pavanbavirisetty9724 4 роки тому

    If i gave a size (width,height) in (20,20) the frame is occupying a gray color at the borders

  • @TheMarbo74
    @TheMarbo74 4 роки тому

    Hi Corey, Any chance we would see some Open CV in the near future?

  • @florinracoveanu1772
    @florinracoveanu1772 9 років тому

    Hi!
    What code shall I use, in Python when I have to check automatically like 400 high resolution photos(RGB,thermal,and daylight)?
    The program shall detect sub-milimmiter anomalies(like small cracks) inside of each photo,if any,if not should scan the next one,etc.Exemple of inspection:wind turbines,flare stacks,etc.
    Thanks in advance,
    Costel

    • @WesleySatelis
      @WesleySatelis 8 років тому

      +FLORIN RACOVEANU I guess you're gonna have to figure that out, isn't that what programming is supposed to be? pypi.python.org/pypi/PIL this might be a good way to start. Happy coding!

  • @ErnestGWilsonII
    @ErnestGWilsonII 6 років тому

    Another great video, thank you for making this and sharing it with all of us! Following along this video and referencing another video that you made, would it be advisable to make a context method for doing image manipulation? One of your previous videos uses something you call a context method for opening and closing files, but in that video you mention a context method could be created for various other tasks, I am wondering if this image manipulation would be applicable?

  • @cartoonjerk
    @cartoonjerk 7 років тому

    Thanks a lot for the detailed tutorial. I am wondering if you can do one on the Python 3 version as it is quite different than the one you showed here. Still regardless thanks a lot! It really helps as a start. Also I am using a windows platform, do I still need that os.listdir code? Thanks!

  • @DanielWeikert
    @DanielWeikert 8 років тому +1

    Great video. Is there a way to tell python to go to a webserver, login and enter the folder to change the files there or does this only work locally? Thanks

    • @coreyms
      @coreyms  8 років тому

      I'm sure there are ways you can do that. Is this a webserver you have access to? If so, it may be worthwhile to install python on that server and maybe run a cron task to do what you want on a regular basis. I'm not sure of your usecase exactly, but we do things like that at my work a lot. Hope that helps. Thanks.

  • @lionpersia
    @lionpersia 7 років тому +1

    I looked up online but I couldn't find it. The method PIL.Image.getpixel(x, y) is 0-based or 1-based? I mean, do the coordinates start from 0 or do they start from 1? Thank you in advance.

  • @LaunchpadMediaGroup1
    @LaunchpadMediaGroup1 4 роки тому

    do you know a way to create a new folder within the code as well? I want to create a template script I can use and generate a directory of folders in the process of creating the image variations. Another question is can you put a black or white background on a jpg being created from a transparent png?

  • @vinodkinoni4863
    @vinodkinoni4863 5 років тому +1

    awesome

  • @shahriarkeshvary1459
    @shahriarkeshvary1459 5 років тому

    Great video but I have question. I looked around a lot to figure out a way to convert a 'jp2' image to something else. Apparently 'PIL' library does not support this format. I also tried the 'matplotlib' and that one did not work as well. do you have any recommendation to how convert a 'jp2' format to a 'mpeg' or 'Jpeg' using python? I really appreciate the help.

  • @SA-oj3bo
    @SA-oj3bo 3 роки тому

    from PIL import Image
    im = Image.open("photo.jpg") => not works on raspberry pi,
    Do you have any idea how to solve this? xli seems possible but the quality is terrible.. Thx!

  • @TheMarbo74
    @TheMarbo74 4 роки тому

    Great video.. as usual!
    I'm concerned about the following note found on the Pillow website:
    "Pillow and PIL cannot co-exist in the same environment. Before installing Pillow, please uninstall PIL."
    Is PIL pre-installed on the default Python installation? If yes, how do we do that?
    Thanks

  • @gokulhbk
    @gokulhbk 3 роки тому

    How can I use PIL to create multiple PNG images as combinations of PNG images from a holder. You can imagine it as simple as a random avatar generator ( Face+Hat+Clothing+Shades)