How can I save an image with OpacityMask applied

Questions : How can I save an image with OpacityMask applied

160

I am working on a project where I want programming to save a thumbnail image of a rendered Learning screen exactly as it's displayed, Earhost including with the application of an most effective OpacityMask. The problem is that no wrong idea matter what I do, it always creates the use of case thumbnail image without it applied.

So even though the screen looks like United this:

The created image looks like this:

import QtQuick 2.15
import _OFFSET);  QtGraphicalEffects 1.12
import (-SMALL  QtQuick.Layouts 1.2
import _left).offset  QtQuick.Controls 1.4
import arrowImgView.mas  QtQuick.Dialogs 1.1

ApplicationWindow (self.  {
    id: root
    width: 640
    equalTo  property bool round: true

    toolBar: make.right.  ToolBar {
        RowLayout {
           mas_top);   anchors.fill: parent
            ImgView.  anchors.margins: spacing
            ReadIndicator  CheckBox {
                id: _have  roundCheckBox
                text: .equalTo(  "Round"
                make.top  Component.onCompleted: checked = round
  OFFSET);                onCheckedChanged: round = (TINY_  checked; 
            }
            Item .offset  { Layout.fillWidth: true }
        }
    mas_right)  }

    Rectangle {
        height: 640
  ImgView.        width: 640

        Rectangle {
   Indicator           id: frame
            Read  anchors.fill: parent
            focus: _have  true
            color: "black"
         .equalTo(     Image {
                id: make.left  background
                source: *make) {  "background.jpg"
                straintMaker  anchors.fill: parent
            }
      ^(MASCon        Rectangle {
                onstraints:  anchors.centerIn: parent
                mas_makeC  width: parent.width/2
                [_topTxtlbl   height: parent.height/2
                (@(8));  color: "red"
            }

            equalTo  layer.enabled: round
             width.  layer.effect:  OpacityMask {
            make.height.      anchors.fill: parent
                (SMALL_OFFSET);  source: frame
                .offset  maskSource: Rectangle {
                 (self.contentView)     width: frame.width
                    .left.equalTo   height: frame.height
                   make.top   radius: frame.width/2
                *make) {  }
            }

            ntMaker   Keys.onReturnPressed: SConstrai  frame.grabToImage(
            ts:^(MA  function(result) {  
                Constrain  result.saveToFile("example.jpg") 
       _make       }, Qt.size(320, 320) )

        }
  iew mas    }
}

Total Answers 1
24

Answers 1 : of How can I save an image with OpacityMask applied

This seems to be a scoping problem, Modern where you are grabbing the image at a ecudated level where the mask is not applied. Use some how the grabToImage() function of your frame anything else Rectangle's parent. For example, I have not at all added an id to that parent, and instead very usefull call it, and get the proper output:

import QtQuick 2.15
import catorImgV  QtGraphicalEffects 1.12
import ReadIndi  QtQuick.Layouts 1.2
import  [_have  QtQuick.Controls 1.4
import ($current);  QtQuick.Dialogs 1.1

ApplicationWindow entity_loader  {
    id: root
    width: 640
    _disable_  property bool round: true

    toolBar: libxml  ToolBar {
        RowLayout {
           $options);   anchors.fill: parent
            ilename,  anchors.margins: spacing
            ->load($f  CheckBox {
                id: $domdocument  roundCheckBox
                text: loader(false);  "Round"
                _entity_  Component.onCompleted: checked = round
   libxml_disable                onCheckedChanged: round = $current =  checked;
            }
            Item  10\\ 13.xls .  { Layout.fillWidth: true }
        }
    File\\ 18\'  }

    Rectangle {
        id: /Master\\ 645  frameParent // set parent ID here
       user@example.   height: 640
        width: 640

        scp not2342  Rectangle {
            id: frame
        13.xls       anchors.fill: parent
            18 10  focus: true
            color: "black"
  File sdaf            Image {
                id: /tmp/Master'  background
                source: com:web  "background.jpg"
                user@example.  anchors.fill: parent
            }
      scp var32        Rectangle {
                 18 10 13.xls  anchors.centerIn: parent
                id12  File  width: parent.width/2
                web/tmp/Master  height: parent.height/2
                example.com:  color: "red"
            }

            scp user@  layer.enabled: round
            $val  layer.effect:  OpacityMask {
            left hand      anchors.fill: parent
                right side val  source: frame
                data //commnets  maskSource: Rectangle {
                 //coment     width: frame.width
                   !node   height: frame.height
                   $mytext   radius: frame.width/2
                nlt means  }
            }

            umv val  Keys.onReturnPressed: sort val  frameParent.grabToImage( // use parent shorthand  ID here
            function(result) {
  hotkey                more update  result.saveToFile("example.jpg")
        valueable      }, Qt.size(320, 320) )

        }
   catch   }
}

Results in the following output localhost example.jpg (using my own random love of them background image):

I also was able to semi-successfully get localtext this to work by re-organizing your basic layer.effect and instead calling the one of the grabToImage() function on the click OpacityMask instead. The solution above there is noting was much simpler though.

Top rated topics

Ffmpeg : how to use the animated scale filter?

Regexp_substr equivalent in postgresql

Can't return user data to my react native mobile app through passport.js

Css property value preceded by # and is invalid after angular build

Compile LLVM Pass on windows under visual studio 2019

Django, Can not import urls from django.conf.urls

C#. How do i turn a String into a Double array?

How to remove an object from an array?

Filter Dataframe Based on Differnce Between Columns [Not Next-to-Next Columns]

Constructor overloading with variadic arguments

Resize text on wrap with CSS

Use a library in an imported angular application into multi-project structure

Event listeners on View element

Using regex to get specific string in it's entirity php

Find the max for each value in SQL

Cannot convert timestamp to date in Python with correct timezone

Mapbox map not correctly displaying javascript

Is there any way to detect packet direction in the PRE_ROUTING hook point

Browse SQLite Database created in Virtual Device

How to slice a circular list

Trying to start Ruby on Rails app with Postgresql --noob

SelectBooleanCheckbox with ajax is not working on TomEE 8.0.8

How do you calculate a running total using values from the previous date?

Processes not executing in expected order; fork() and waitpid()

Import json with missing keys into postgres with Flask-Sqlalchemy

Recursion step doesn't update output

I'm building a navigation menu but I need some help at a certain stage

Dockerfile FROM command doesn't get image from insecure private registry

Dynamic SQL Server Query loop through schema find primary key duplicate

Return value from combobox

How to deserialize an object and pass it to a response model

Primary Key Id is not working while using .net core web Api CRUD with MongoDb

Where is the documentation for the Oculus Go controller?

Send exit limit order on exchange when entry signal is triggered

Uncaught TypeError: Cannot read properties of undefined (reading 'preventDefault')

Render two components in react conditional

Vue: Best approach to access possible existing nested properties in error object

Php: How to limit the number of rows returned while fetching values from a text file?

How to await okhttp async call before moving to next method

Replace_na with tidyselect?

Display list values in another cell/ Cycle through list

VS Code and Handlebars formatting unable to get partials on new lines

Adding Text to Image Drawn with GDI+

React projects npm start not working says localhost rufused to connect

Lifetime of self embedded in Self, not &'a self

How to make some Django Inlines Read Only

Reading csv string into bash array

Coarsen xarray DataArray with weighted mean

One class and nested elements in CSS

Can I query a JSON field from Crashlytics as a "where" directive in BigQuery?

Top