# Path: pdil/vendor/Qt.py
# QT_VERBOSE = bool(os.getenv("QT_VERBOSE"))
# QT_PREFERRED_BINDING = os.getenv("QT_PREFERRED_BINDING", "")
# QT_SIP_API_HINT = os.getenv("QT_SIP_API_HINT")
# def _qInstallMessageHandler(handler):
#     def messageOutputHandler(*args):
# def _getcpppointer(object):
# def _wrapinstance(ptr, base=None):
# def _translate(context, sourceText, *args):
# def _loadUi(uifile, baseinstance=None):
#             def __init__(self, baseinstance):
#             def _loadCustomWidgets(self, etree):
#                 def headerToModule(header):
#             def load(self, uifile, *args, **kwargs):
#             def createWidget(self, class_name, parent=None, name=""):
# def _apply_site_config():
# def _new_module(name):
# def _import_sub_module(module, name):
# def _setup(module, extras):
# def _reassign_misplaced_members(binding):
# def _build_compatibility_members(binding, decorators=None):
# def _pyside2():
# def _pyside():
# def _pyqt5():
# def _pyqt4():
#     def _standardizeQFileDialog(some_function):
#         def wrapper(*args, **kwargs):
# def _none():
# def _log(text):
# def _convert(lines):
#     def parse(line):
# def _cli(args):
# def _install():
#         class _UiLoader(Qt._QtUiTools.QUiLoader):


import collections
import math
from ..vendor.Qt import QtGui, QtWidgets
from ..vendor.Qt.QtCore import QPoint
        src_ratio = src_width / src_height
        new_ratio = new_width / new_height
        # This means the new image needs to be made taller
        if src_ratio < new_ratio:
            adjusted_height = round( (1 / src_ratio) * new_width)
            top, bottom = disperse(top, bottom, new_height, adjusted_height)
        
        # This means the new image needs to be made wider
        elif src_ratio > new_ratio:
            adjusted_width = round(src_ratio * new_height)
            left, right = disperse(left, right, new_width, adjusted_width)
    
    cropped = img.copy( left, top, right - left, bottom - top )
    
    return cropped


def identifyContent(img, chroma):
    ''' Taking a pixel at the give coord (or alpha), return the minimum rectangle containing content.
    
    Args:
        img: A Pixmap
        chroma: Either a pixel representing the chromakey or 'alpha' to use the alpha channel.
    '''
    #px = img.load()
    #chroma = px[x, y]

    if chroma == 'alpha':
        def column_is_empty(x):
            for y in range(img.height()):

# Path: pdil/vendor/Qt.py
# QT_VERBOSE = bool(os.getenv("QT_VERBOSE"))
# QT_PREFERRED_BINDING = os.getenv("QT_PREFERRED_BINDING", "")
# QT_SIP_API_HINT = os.getenv("QT_SIP_API_HINT")
# def _qInstallMessageHandler(handler):
#     def messageOutputHandler(*args):
# def _getcpppointer(object):
# def _wrapinstance(ptr, base=None):
# def _translate(context, sourceText, *args):
# def _loadUi(uifile, baseinstance=None):
#             def __init__(self, baseinstance):
#             def _loadCustomWidgets(self, etree):
#                 def headerToModule(header):
#             def load(self, uifile, *args, **kwargs):
#             def createWidget(self, class_name, parent=None, name=""):
# def _apply_site_config():
# def _new_module(name):
# def _import_sub_module(module, name):
# def _setup(module, extras):
# def _reassign_misplaced_members(binding):
# def _build_compatibility_members(binding, decorators=None):
# def _pyside2():
# def _pyside():
# def _pyqt5():
# def _pyqt4():
#     def _standardizeQFileDialog(some_function):
#         def wrapper(*args, **kwargs):
# def _none():
# def _log(text):
# def _convert(lines):
#     def parse(line):
# def _cli(args):
# def _install():
#         class _UiLoader(Qt._QtUiTools.QUiLoader):


# Path: pdil/_core/image.py
import collections
import math
from ..vendor.Qt import QtGui, QtWidgets
from ..vendor.Qt.QtCore import QPoint

        src_ratio = src_width / src_height
        new_ratio = new_width / new_height
        # This means the new image needs to be made taller
        if src_ratio < new_ratio:
            adjusted_height = round( (1 / src_ratio) * new_width)
            top, bottom = disperse(top, bottom, new_height, adjusted_height)
        
        # This means the new image needs to be made wider
        elif src_ratio > new_ratio:
            adjusted_width = round(src_ratio * new_height)
            left, right = disperse(left, right, new_width, adjusted_width)
    
    cropped = img.copy( left, top, right - left, bottom - top )
    
    return cropped


def identifyContent(img, chroma):
    ''' Taking a pixel at the give coord (or alpha), return the minimum rectangle containing content.
    
    Args:
        img: A Pixmap
        chroma: Either a pixel representing the chromakey or 'alpha' to use the alpha channel.
    '''
    #px = img.load()
    #chroma = px[x, y]

    if chroma == 'alpha':
        def column_is_empty(x):
            for y in range(img.height()):

                if QtGui.qAlpha(img.pixel(x, y)):