Skip to content

PythonQt.QtGui.QImage · declarations 002

Back to PythonQt.QtGui.QImage

constScanLine

constScanLine(line: Any) -> str

X.constScanLine(line)

Supplemental documentation: Qt 5 reference:

const uchar *QImage::constScanLine(int i) const

Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0.

The scanline data is as minimum 32-bit aligned. For 64-bit formats it follows the native alignment of 64-bit integers (64-bit for most platforms, but notably 32-bit on i386).

Note that QImage uses implicit data sharing, but this function does not perform a deep copy of the shared pixel data, because the returned data is const.

This function was introduced in Qt 4.7.

See also scanLine() and constBits().

Upstream PySide2 reference signatures (binding differences may apply):

constScanLine(self, arg__1: int) -> str

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#constScanLine

convertToFormat

convertToFormat(f: Any, colorTable: Any, arg2: flags) -> Any

X.convertToFormat(f, colorTable, flags) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QImage::convertToFormat(QImage::Format format, Qt::ImageConversionFlags flags \= Qt::AutoColor) \&\&

QImage QImage::convertToFormat(QImage::Format format, Qt::ImageConversionFlags flags \= Qt::AutoColor) const \&

QImage QImage::convertToFormat(QImage::Format format, const QVector\<QRgb> \&colorTable, Qt::ImageConversionFlags flags \= Qt::AutoColor) const

This is an overloaded function.

Returns a copy of the image converted to the given format, using the specified colorTable.

Conversion from RGB formats to indexed formats is a slow operation and will use a straightforward nearest color approach, with no dithering.

Upstream PySide2 reference signatures (binding differences may apply):

convertToFormat(self, f: PySide2.QtGui.QImage.Format, colorTable: typing.List[int], flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> PySide2.QtGui.QImage
convertToFormat(self, f: PySide2.QtGui.QImage.Format, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#convertToFormat

convertToFormat_helper

convertToFormat_helper(format: Any, arg1: flags) -> Any

X.convertToFormat_helper(format, flags) -> PythonQt.QtGui.QImage

Upstream PySide2 reference signatures (binding differences may apply):

convertToFormat_helper(self, format: PySide2.QtGui.QImage.Format, flags: PySide2.QtCore.Qt.ImageConversionFlags) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#convertToFormat_helper

convertToFormat_inplace

convertToFormat_inplace(format: Any, arg1: flags) -> bool

X.convertToFormat_inplace(format, flags) -> bool

Upstream PySide2 reference signatures (binding differences may apply):

convertToFormat_inplace(self, format: PySide2.QtGui.QImage.Format, flags: PySide2.QtCore.Qt.ImageConversionFlags) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#convertToFormat_inplace

copy

copy(x: Any, y: Any, w: Any, h: Any) -> Any

X.copy(x, y, w, h) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QImage::copy(const QRect \&rectangle \= QRect()) const

Returns a sub-area of the image as a new image.

The returned image is copied from the position (rectangle.x(), rectangle.y()) in this image, and will always have the size of the given rectangle.

In areas beyond this image, pixels are set to 0. For 32-bit RGB images, this means black; for 32-bit ARGB images, this means transparent black; for 8-bit images, this means the color with index 0 in the color table which can be anything; for 1-bit images, this means Qt::color0.

If the given rectangle is a null rectangle the entire image is copied.

See also QImage().

QImage QImage::copy(int x, int y, int width, int height) const

This is an overloaded function.

The returned image is copied from the position (x, y) in this image, and will always have the given width and height. In areas beyond this image, pixels are set to 0.

Upstream PySide2 reference signatures (binding differences may apply):

copy(self, rect: PySide2.QtCore.QRect=...) -> PySide2.QtGui.QImage
copy(self, x: int, y: int, w: int, h: int) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#copy

createAlphaMask

createAlphaMask(arg0: flags) -> Any

X.createAlphaMask(flags) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags \= Qt::AutoColor) const

Builds and returns a 1-bpp mask from the alpha buffer in this image. Returns a null image if the image's format is QImage::Format_RGB32.

The flags argument is a bitwise-OR of the Qt::ImageConversionFlags, and controls the conversion process. Passing 0 for flags sets all the default options.

The returned image has little-endian bit order (i.e. the image's format is QImage::Format_MonoLSB), which you can convert to big-endian (QImage::Format_Mono) using the convertToFormat() function.

See also createHeuristicMask() and Image Transformations.

Upstream PySide2 reference signatures (binding differences may apply):

createAlphaMask(self, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#createAlphaMask

createHeuristicMask

createHeuristicMask(clipTight: bool) -> Any

X.createHeuristicMask(clipTight) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QImage::createHeuristicMask(bool clipTight \= true) const

Creates and returns a 1-bpp heuristic mask for this image.

The function works by selecting a color from one of the corners, then chipping away pixels of that color starting at all the edges. The four corners vote for which color is to be masked away. In case of a draw (this generally means that this function is not applicable to the image), the result is arbitrary.

The returned image has little-endian bit order (i.e. the image's format is QImage::Format_MonoLSB), which you can convert to big-endian (QImage::Format_Mono) using the convertToFormat() function.

If clipTight is true (the default) the mask is just large enough to cover the pixels; otherwise, the mask is larger than the data pixels.

Note that this function disregards the alpha buffer.

See also createAlphaMask() and Image Transformations.

Upstream PySide2 reference signatures (binding differences may apply):

createHeuristicMask(self, clipTight: bool=...) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#createHeuristicMask

createMaskFromColor

createMaskFromColor(color: int, mode: Any) -> Any

X.createMaskFromColor(color, mode) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode \= Qt::MaskInColor) const

Creates and returns a mask for this image based on the given color value. If the mode is MaskInColor (the default value), all pixels matching color will be opaque pixels in the mask. If mode is MaskOutColor, all pixels matching the given color will be transparent.

See also createAlphaMask() and createHeuristicMask().

Upstream PySide2 reference signatures (binding differences may apply):

createMaskFromColor(self, color: int, mode: PySide2.QtCore.Qt.MaskMode=...) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#createMaskFromColor

depth

depth() -> int

X.depth() -> int

Supplemental documentation: Qt 5 reference:

int QImage::depth() const

Returns the depth of the image.

The image depth is the number of bits used to store a single pixel, also called bits per pixel (bpp).

The supported depths are 1, 8, 16, 24, 32 and 64.

See also bitPlaneCount(), convertToFormat(), Image Formats, and Image Information.

Upstream PySide2 reference signatures (binding differences may apply):

depth(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#depth

devType

devType() -> int

X.devType() -> int

Upstream PySide2 reference signatures (binding differences may apply):

devType(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#devType

devicePixelRatio

devicePixelRatio() -> float

X.devicePixelRatio() -> float

Supplemental documentation: Qt 5 reference:

qreal QImage::devicePixelRatio() const

Returns the device pixel ratio for the image. This is the ratio between device pixels and device independent pixels.

Use this function when calculating layout geometry based on the image size: QSize layoutSize \= image.size() / image.devicePixelRatio()

The default value is 1.0.

See also setDevicePixelRatio() and QImageReader.

Upstream PySide2 reference signatures (binding differences may apply):

devicePixelRatio(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#devicePixelRatio

dotsPerMeterX

dotsPerMeterX() -> int

X.dotsPerMeterX() -> int

Supplemental documentation: Qt 5 reference:

int QImage::dotsPerMeterX() const

Returns the number of pixels that fit horizontally in a physical meter. Together with dotsPerMeterY(), this number defines the intended scale and aspect ratio of the image.

See also setDotsPerMeterX() and Image Information.

Upstream PySide2 reference signatures (binding differences may apply):

dotsPerMeterX(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#dotsPerMeterX

dotsPerMeterY

dotsPerMeterY() -> int

X.dotsPerMeterY() -> int

Supplemental documentation: Qt 5 reference:

int QImage::dotsPerMeterY() const

Returns the number of pixels that fit vertically in a physical meter. Together with dotsPerMeterX(), this number defines the intended scale and aspect ratio of the image.

See also setDotsPerMeterY() and Image Information.

Upstream PySide2 reference signatures (binding differences may apply):

dotsPerMeterY(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#dotsPerMeterY

fill

fill(color: Any) -> None

X.fill(color)

Supplemental documentation: Qt 5 reference:

void QImage::fill(uint pixelValue)

Fills the entire image with the given pixelValue.

If the depth of this image is 1, only the lowest bit is used. If you say fill(0), fill(2), etc., the image is filled with 0s. If you say fill(1), fill(3), etc., the image is filled with 1s. If the depth is 8, the lowest 8 bits are used and if the depth is 16 the lowest 16 bits are used.

Note: QImage::pixel() returns the color of the pixel at the given coordinates while QColor::pixel() returns the pixel value of the underlying window system (essentially an index value), so normally you will want to use QImage::pixel() to use a color from an existing image or QColor::rgb() to use a specific color.

See also depth() and Image Transformations.

void QImage::fill(const QColor \&color)

This is an overloaded function.

Fills the entire image with the given color.

If the depth of the image is 1, the image will be filled with 1 if color equals Qt::color1; it will otherwise be filled with 0.

If the depth of the image is 8, the image will be filled with the index corresponding the color in the color table if present; it will otherwise be filled with 0.

This function was introduced in Qt 4.8.

void QImage::fill(Qt::GlobalColor color)

This is an overloaded function.

Fills the image with the given color, described as a standard global color.

This function was introduced in Qt 4.8.

Upstream PySide2 reference signatures (binding differences may apply):

fill(self, color: PySide2.QtCore.Qt.GlobalColor) -> None
fill(self, color: PySide2.QtGui.QColor) -> None
fill(self, pixel: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#fill

format

format() -> Any

X.format()

Supplemental documentation: Qt 5 reference:

QImage::Format QImage::format() const

Returns the format of the image.

See also Image Formats.

Upstream PySide2 reference signatures (binding differences may apply):

format(self) -> PySide2.QtGui.QImage.Format

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#format

fromData

fromData(data: Any, format: Any) -> Any

X.fromData(data, format) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

[static] QImage QImage::fromData(const uchar *data, int size, const char *format \= nullptr)

Constructs a QImage from the first size bytes of the given binary data. The loader attempts to read the image using the specified format. If format is not specified (which is the default), the loader probes the data for a header to guess the file format.

If format is specified, it must be one of the values returned by QImageReader::supportedImageFormats().

If the loading of the image fails, the image returned will be a null image.

See also load(), save(), and Reading and Writing Image Files.

[static] QImage QImage::fromData(const QByteArray \&data, const char *format \= nullptr)

This is an overloaded function.

Loads an image from the given QByteArray data.

Upstream PySide2 reference signatures (binding differences may apply):

fromData(data: PySide2.QtCore.QByteArray, format: typing.Optional[str]=...) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#fromData

hasAlphaChannel

hasAlphaChannel() -> bool

X.hasAlphaChannel() -> bool

Supplemental documentation: Qt 5 reference:

bool QImage::hasAlphaChannel() const

Returns true if the image has a format that respects the alpha channel, otherwise returns false.

See also Image Information.

Upstream PySide2 reference signatures (binding differences may apply):

hasAlphaChannel(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#hasAlphaChannel

height

height() -> int

X.height() -> int

Supplemental documentation: Qt 5 reference:

int QImage::height() const

Returns the height of the image.

See also Image Information.

Upstream PySide2 reference signatures (binding differences may apply):

height(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#height

invertPixels

invertPixels(arg__1: Any) -> None

X.invertPixels(arg__1)

Supplemental documentation: Qt 5 reference:

void QImage::invertPixels(QImage::InvertMode mode \= InvertRgb)

Inverts all pixel values in the image.

The given invert mode only have a meaning when the image's depth is 32. The default mode is InvertRgb, which leaves the alpha channel unchanged. If the mode is InvertRgba, the alpha bits are also inverted.

Inverting an 8-bit image means to replace all pixels using color index i with a pixel using color index 255 minus i. The same is the case for a 1-bit image. Note that the color table is not changed.

If the image has a premultiplied alpha channel, the image is first converted to an unpremultiplied image format to be inverted and then converted back.

See also Image Transformations.

Upstream PySide2 reference signatures (binding differences may apply):

invertPixels(self, mode: PySide2.QtGui.QImage.InvertMode=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#invertPixels

isGrayscale

isGrayscale() -> bool

X.isGrayscale() -> bool

Supplemental documentation: Qt 5 reference:

bool QImage::isGrayscale() const

For 32-bit images, this function is equivalent to allGray().

For color indexed images, this function returns true if color(i) is QRgb(i, i, i) for all indexes of the color table; otherwise returns false.

See also allGray() and Image Formats.

Upstream PySide2 reference signatures (binding differences may apply):

isGrayscale(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#isGrayscale

isNull

isNull() -> bool

X.isNull() -> bool

Supplemental documentation: Qt 5 reference:

bool QImage::isNull() const

Returns true if it is a null image, otherwise returns false.

A null image has all parameters set to zero and no allocated data.

Upstream PySide2 reference signatures (binding differences may apply):

isNull(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#isNull

load

load(device: Any, format: Any) -> bool

X.load(device, format) -> bool

Supplemental documentation: Qt 5 reference:

bool QImage::load(const QString \&fileName, const char *format \= nullptr)

Loads an image from the file with the given fileName. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), it is auto-detected based on the file's suffix and header. For details, see QImageReader::setAutoDetectImageFormat().

The file name can either refer to an actual file on disk or to one of the application's embedded resources. See the Resource System overview for details on how to embed images and other resource files in the application's executable.

See also Reading and Writing Image Files.

bool QImage::load(QIODevice *device, const char *format)

This is an overloaded function.

This function reads a QImage from the given device. This can, for example, be used to load an image directly into a QByteArray.

Upstream PySide2 reference signatures (binding differences may apply):

load(self, device: PySide2.QtCore.QIODevice, format: str) -> bool
load(self, fileName: str, format: typing.Optional[str]=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#load

loadFromData

loadFromData(data: Any, aformat: Any) -> bool

X.loadFromData(data, aformat) -> bool

Supplemental documentation: Qt 5 reference:

bool QImage::loadFromData(const uchar *data, int len, const char *format \= nullptr)

Loads an image from the first len bytes of the given binary data. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), the loader probes the file for a header to guess the file format.

See also Reading and Writing Image Files.

bool QImage::loadFromData(const QByteArray \&data, const char *format \= nullptr)

This is an overloaded function.

Loads an image from the given QByteArray data.

Upstream PySide2 reference signatures (binding differences may apply):

loadFromData(self, data: PySide2.QtCore.QByteArray, aformat: typing.Optional[str]=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#loadFromData

metric

metric(metric: Any) -> int

X.metric(metric) -> int

Upstream PySide2 reference signatures (binding differences may apply):

metric(self, metric: PySide2.QtGui.QPaintDevice.PaintDeviceMetric) -> int

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#metric

mirrored

mirrored(horizontally: bool, vertically: bool) -> Any

X.mirrored(horizontally, vertically) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage \&\&QImage::mirrored(bool horizontal \= false, bool vertical \= true) \&\&

QImage QImage::mirrored(bool horizontal \= false, bool vertical \= true) const \&

Upstream PySide2 reference signatures (binding differences may apply):

mirrored(self, horizontally: bool=..., vertically: bool=...) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#mirrored

mirrored_helper

mirrored_helper(horizontal: bool, vertical: bool) -> Any

X.mirrored_helper(horizontal, vertical) -> PythonQt.QtGui.QImage

Upstream PySide2 reference signatures (binding differences may apply):

mirrored_helper(self, horizontal: bool, vertical: bool) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#mirrored_helper

mirrored_inplace

mirrored_inplace(horizontal: bool, vertical: bool) -> None

X.mirrored_inplace(horizontal, vertical)

Upstream PySide2 reference signatures (binding differences may apply):

mirrored_inplace(self, horizontal: bool, vertical: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#mirrored_inplace

offset

offset() -> Any

X.offset() -> PythonQt.QtCore.QPoint

Supplemental documentation: Qt 5 reference:

QPoint QImage::offset() const

Returns the number of pixels by which the image is intended to be offset by when positioning relative to other images.

See also setOffset() and Image Information.

Upstream PySide2 reference signatures (binding differences may apply):

offset(self) -> PySide2.QtCore.QPoint

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#offset

paintEngine

paintEngine() -> Any

X.paintEngine() -> PythonQt.QtGui.QPaintEngine

Upstream PySide2 reference signatures (binding differences may apply):

paintEngine(self) -> PySide2.QtGui.QPaintEngine

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#paintEngine

pixel

pixel(x: Any, y: Any) -> int

X.pixel(x, y) -> int

Supplemental documentation: Qt 5 reference:

QRgb QImage::pixel(const QPoint \&position) const

Returns the color of the pixel at the given position.

If the position is not valid, the results are undefined.

Warning: This function is expensive when used for massive pixel manipulations. Use constBits() or constScanLine() when many pixels needs to be read.

See also setPixel(), valid(), constBits(), constScanLine(), and Pixel Manipulation.

QRgb QImage::pixel(int x, int y) const

This is an overloaded function.

Returns the color of the pixel at coordinates (x, y).

Upstream PySide2 reference signatures (binding differences may apply):

pixel(self, pt: PySide2.QtCore.QPoint) -> int
pixel(self, x: int, y: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#pixel

pixelColor

pixelColor(x: Any, y: Any) -> Any

X.pixelColor(x, y) -> PythonQt.QtGui.QColor

Supplemental documentation: Qt 5 reference:

QColor QImage::pixelColor(const QPoint \&position) const

Returns the color of the pixel at the given position as a QColor.

If the position is not valid, an invalid QColor is returned.

Warning: This function is expensive when used for massive pixel manipulations. Use constBits() or constScanLine() when many pixels needs to be read.

This function was introduced in Qt 5.6.

See also setPixelColor(), setPixel(), valid(), constBits(), constScanLine(), and Pixel Manipulation.

QColor QImage::pixelColor(int x, int y) const

This is an overloaded function.

Returns the color of the pixel at coordinates (x, y) as a QColor.

This function was introduced in Qt 5.6.

Upstream PySide2 reference signatures (binding differences may apply):

pixelColor(self, pt: PySide2.QtCore.QPoint) -> PySide2.QtGui.QColor
pixelColor(self, x: int, y: int) -> PySide2.QtGui.QColor

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#pixelColor

pixelFormat

pixelFormat() -> Any

X.pixelFormat() -> PythonQt.QtGui.QPixelFormat

Supplemental documentation: Qt 5 reference:

QPixelFormat QImage::pixelFormat() const

Returns the QImage::Format as a QPixelFormat

Upstream PySide2 reference signatures (binding differences may apply):

pixelFormat(self) -> PySide2.QtGui.QPixelFormat

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#pixelFormat

pixelIndex

pixelIndex(x: Any, y: Any) -> int

X.pixelIndex(x, y) -> int

Supplemental documentation: Qt 5 reference:

int QImage::pixelIndex(const QPoint \&position) const

Returns the pixel index at the given position.

If position is not valid, or if the image is not a paletted image (depth() > 8), the results are undefined.

See also valid(), depth(), and Pixel Manipulation.

int QImage::pixelIndex(int x, int y) const

This is an overloaded function.

Returns the pixel index at (x, y).

Upstream PySide2 reference signatures (binding differences may apply):

pixelIndex(self, pt: PySide2.QtCore.QPoint) -> int
pixelIndex(self, x: int, y: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#pixelIndex

rect

rect() -> Any

X.rect() -> PythonQt.QtCore.QRect

Supplemental documentation: Qt 5 reference:

QRect QImage::rect() const

Returns the enclosing rectangle (0, 0, width(), height()) of the image.

See also Image Information.

Upstream PySide2 reference signatures (binding differences may apply):

rect(self) -> PySide2.QtCore.QRect

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#rect

rgbSwapped

rgbSwapped() -> Any

X.rgbSwapped() -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage \&\&QImage::rgbSwapped() \&\&

QImage QImage::rgbSwapped() const \&

Upstream PySide2 reference signatures (binding differences may apply):

rgbSwapped(self) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#rgbSwapped

rgbSwapped_helper

rgbSwapped_helper() -> Any

X.rgbSwapped_helper() -> PythonQt.QtGui.QImage

Upstream PySide2 reference signatures (binding differences may apply):

rgbSwapped_helper(self) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#rgbSwapped_helper

rgbSwapped_inplace

rgbSwapped_inplace() -> None

X.rgbSwapped_inplace()

Upstream PySide2 reference signatures (binding differences may apply):

rgbSwapped_inplace(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#rgbSwapped_inplace

save

save(device: Any, format: Any, quality: int) -> bool

X.save(device, format, quality) -> bool

Supplemental documentation: Qt 5 reference:

bool QImage::save(const QString \&fileName, const char *format \= nullptr, int quality \= -1) const

Saves the image to the file with the given fileName, using the given image file format and quality factor. If format is nullptr, QImage will attempt to guess the format by looking at fileName's suffix.

The quality factor must be in the range 0 to 100 or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 (the default) to use the default settings.

Returns true if the image was successfully saved; otherwise returns false.

See also Reading and Writing Image Files.

bool QImage::save(QIODevice *device, const char *format \= nullptr, int quality \= -1) const

This is an overloaded function.

This function writes a QImage to the given device.

This can, for example, be used to save an image directly into a QByteArray:

        QImage image;
        QByteArray ba;
        QBuffer buffer(&ba);
        buffer.open(QIODevice::WriteOnly);
        image.save(&buffer, "PNG"); // writes image into ba in PNG format

Upstream PySide2 reference signatures (binding differences may apply):

save(self, device: PySide2.QtCore.QIODevice, format: typing.Optional[str]=..., quality: int=...) -> bool
save(self, fileName: str, format: typing.Optional[str]=..., quality: int=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#save

scaled

scaled(w: Any, h: Any, aspectMode: Any, mode: Any) -> Any

X.scaled(w, h, aspectMode, mode) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QImage::scaled(const QSize \&size, Qt::AspectRatioMode aspectRatioMode \= Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode \= Qt::FastTransformation) const

Returns a copy of the image scaled to a rectangle defined by the given size according to the given aspectRatioMode and transformMode.

  • If aspectRatioMode is Qt::IgnoreAspectRatio, the image is scaled to size.
  • If aspectRatioMode is Qt::KeepAspectRatio, the image is scaled to a rectangle as large as possible inside size, preserving the aspect ratio.
  • If aspectRatioMode is Qt::KeepAspectRatioByExpanding, the image is scaled to a rectangle as small as possible outside size, preserving the aspect ratio.

If the given size is empty, this function returns a null image.

See also isNull() and Image Transformations.

QImage QImage::scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode \= Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode \= Qt::FastTransformation) const

This is an overloaded function.

Returns a copy of the image scaled to a rectangle with the given width and height according to the given aspectRatioMode and transformMode.

If either the width or the height is zero or negative, this function returns a null image.

Upstream PySide2 reference signatures (binding differences may apply):

scaled(self, s: PySide2.QtCore.QSize, aspectMode: PySide2.QtCore.Qt.AspectRatioMode=..., mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QImage
scaled(self, w: int, h: int, aspectMode: PySide2.QtCore.Qt.AspectRatioMode=..., mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#scaled

scaledToHeight

scaledToHeight(h: int, mode: Any) -> Any

X.scaledToHeight(h, mode) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QImage::scaledToHeight(int height, Qt::TransformationMode mode \= Qt::FastTransformation) const

Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformation mode.

This function automatically calculates the width of the image so that the ratio of the image is preserved.

If the given height is 0 or negative, a null image is returned.

See also Image Transformations.

Upstream PySide2 reference signatures (binding differences may apply):

scaledToHeight(self, h: int, mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qimage.html#scaledToHeight