Python Forum
image conversion - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: image conversion (/thread-40755.html)



image conversion - Skaperen - Sep-18-2023

i'm thinking about the design of a (my first) GUI program. this program will need to read image files and display some or all of an image in some or all of the space in the window it is working in (or whole screen if that is chosen by the user). what i am wonder about right now is how to read in various image file formats. i would guess there would be an API to open the image file and read blocks of pixels in some order (probably the order they are stored in the file). is there a package for Python3 that can uncompress and read GIF, JPEG, and PNG formats? more formats is a plus but those three are absolutely needed. it is a big plus if the image reading API is the same (relative to the open image object) for all formats. e.g. i want to avoid separate packages and different APIs for different image formats (but if i have to, it's not a show stopper). an API that can open many files concurrently is a big plus (i might have to store many small image, otherwise). an API that can open output files for image writing, with image compression for the specified format, is a plus. an API that supports video is also a minor plus. support for opening an I/O object in place of a file is a big plus (most packages i have seen, of late, can do this, and specifying the image file format might be required for reading).


RE: image conversion - Gribouillis - Sep-18-2023

Many people use pillow for image processing. I think it's worth a try.


RE: image conversion - Skaperen - Sep-18-2023

looks good to me. thanks!


RE: image conversion - Skaperen - Sep-19-2023

is there a help site/forum for pillow? i've run into ambiguities in the documentation, already.


RE: image conversion - carecavoador - Sep-19-2023

(Sep-19-2023, 12:09 AM)Skaperen Wrote: is there a help site/forum for pillow? i've run into ambiguities in the documentation, already.

The documentation is really the best place to look for. What are the issues you are finding?


RE: image conversion - Skaperen - Sep-20-2023

this seems to be a case where documentation of one part depends on knowing the other parts, or at least remembering an incomplete part until you get to the other parts that will complete the concepts. many tutorials with references tend to be organized like this. it seems they refer to image "channels" as "bands". i don't yet know exactly what i'd get if i want to get a region of an image. "deep pixels"? 3x "bytes"?

i'm continuing through this as time permits. as i build up a bigger picture in my mind these parts may make more sense. i'm hoping to soon reach a point where i can make a simple (not necessarily useful) application sample processing an image. i did make one that tells me the size of image files, given their names. at least it loads cleanly so there are probably no install issues. actually version 7 was already there but now i have version 10 (i don't remember the exact version, Python is 3.8.10, Ubuntu is 20.04.6 LTS).


RE: image conversion - Larz60+ - Sep-20-2023

see Using The image class


RE: image conversion - Skaperen - Sep-20-2023

i think i am at a point i can write a script or two. i should just go ahead and try it out as i read more. the reference part of the docs should be readable for me, now.