Home > front end >  Is There a way to print pictures With a printer using python?
Is There a way to print pictures With a printer using python?

Time:11-13

I Saw there's an option to use the OS library, but how do i print pictures with it? For example, .png files? I don't want to see the image, I want to print it with a printer using Python

import os

os.startfile("C:/Users/gilke/Downloads/File1.txt", "print")

CodePudding user response:

This will only work on windows (10 or 11):

You can do the following:

import os

os.startfile("C:/Users/TestFile.txt", "print")

This will start the file, in its default opener, with the verb 'print', which will print to your default printer. Only requires the os module which comes with the standard library

CodePudding user response:

first thing first type pip install Pillow in your terminal and hit enter then

from PIL import Image
myImage=Image.open("Your Image here");
myImage.show()

as simple as uploading question on stackOverflow

  • Related