Crop images by transparent

I was looking for script which allows crop iamges by their transparency.
Python comes with help.
You only need to instal PIL librarry

pip install pillow

Script:
Croppes *.png files in current directory, and save under ./cropped directory (you need to create it firstly)

from PIL import Image
import os

def crop_to_content(file_name,file_output):
    image=Image.open(file_name)
    imageBox = image.getbbox()
    cropped=image.crop(imageBox)
    cropped.save(file_output)

if __name__ == '__main__':
    directory = r'.'
    for filename in os.listdir(directory):
        if filename.endswith(".png"):
            crop_to_content(filename, "./cropped/"+filename)
        else:
            continue

Read more

Windows Use UTC Time

ctrl+R -> RegEdit -> enter Registry: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation Key: RealTimeIsUniversal Type: DWORD (32-bit) Value. Value: 1 Then restart PC

Extend »

Missing foreign keys finder

Sometimes when you need to import big bunch of data you may need to consider setting a flag: SET session_replication_role = 'replica'; However, this import,

Extend »

Rider support MAUI .NET

If want to create .NET application with MAUI uusing Rider. you don’t need to install Visual Studio. All you need is run this commands dotnet

Extend »
HTTP 204 - No Content
Scroll to Top