Skip to content

pacman809/HEIC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

This code is used to open and display an image file in the .HEIC format. The .HEIC format is a newer image format that offers better image quality and smaller file sizes compared to older formats such as .JPEG.

The code first imports the necessary modules:

Image from the PIL (Python Image Library) module is used to open and display the image file.
register_heif_opener from the pillow_heif module is used to register the .HEIC file format with the Python Imaging Library (PIL), so that it can be opened and displayed using the Image module.
sys is used to access the command line arguments passed to the script.
ctypes is used to access the Windows API and modify the behavior of the console window.

The code then uses the ctypes module to hide the console window. This is done by calling the ShowWindow function from the Windows API with the following arguments:

ctypes.windll.kernel32.GetConsoleWindow(): Gets a handle to the console window.
6: Specifies that the window should be minimized.

Next, the register_heif_opener function is called to register the .HEIC file format with PIL.

The code then attempts to open the image file specified in the command line arguments using the Image.open function. If the file cannot be opened (e.g. because it is in an unsupported format or the file path is invalid), an exception is raised and the message "Invalid Input" is printed.

Finally, the image is displayed using the show method of the Image object.

Note: The commented-out line #image.show(f'OutPutHEIC.png', quality=100) indicates that the image can also be saved to a .PNG file with a quality of 100%. However, this line is currently commented out, so the image is only displayed and not saved.

About

Opens HEIC Photos for Windows 11

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages