Opacity rectangle png8/23/2023 ![]() kv file it will populate itĭef btn(self): #function btn which occurs. Name = ObjectProperty(None) #initialise as none and then after reading the. note the variables names must be the same between the 2 files #declaire global variables to pass to and from. ie button was pressedįrom import GridLayoutįrom import UrlRequestįrom kivy.properties import ObjectPropertyĬlass MyGrid(Widget): #creates apps layout and contents On_press: root.btn() #if there was an event. Pos: 100, 100 #offset the position to compensate for the boarder Size: root.width-200, root.height-200 #make the widget fit the screen and then minus a border from it #opacity: 0.5 #just affects the widgets not the background kv file however I am unable to find any settings that can adjust to create the desired result.įor simplicity sake I am uploading a shorter code which is layed out in the exact same way as my main code:īackground_color: 0, 0, 0, 0 # only creates a black colour I am testing the programs on a windows computer before uploading to the single board computers and I have been unable to successfully create a blank background. Kivy Video Player is not working on Raspberry 3B+ I have been having issues creating smooth video with the ffpyplayer, the videoplayer used by kivy.ĭue to this I have decided to simply run the app which generates button controls in front of the video and attempt to make the background of the app clear so that both the video and kivy buttons are visible. If you want to see the alpha channel saved as a file called "alpha.png", you can use: magick xc:red \( +clone -threshold 0 -draw "rectangle 10,10 90,90" -write alpha.png \) -channel-fx '| gray=>alpha' result.I am trying to create a video playing app to be run on an single board computer (specifically an OrangePi One/PC using armbian). \) -compose copy-alpha -composite result.png I have no idea why the following doesn't work: magick. The part after the parentheses forces that alpha channel into the original, red image making it transparent where the alpha channel is black and opaque where the alpha channel is white. This becomes the alpha channel in the next step. As the default draw colour is black, the nett result of everything inside the parentheses is that you will get a black rectangle on a white background. I then use -draw "rectangle x0,y0 x1,y1" to draw the "hole" you want to punch in the image. The -threshold 0 makes every pixel with brightness zero or more become white - so that means effectively all pixels become white. It does that with +clone which makes a copy of the original image - crucially the same size but without needing to know the size so it works for any image size. The part inside parentheses makes an alpha channel. That first part is no different from: magick -size 100x100 xc:red. Not sure why I can't find an easy way to do this, but the following should work for even magenta-coloured images: magick xc:red \( +clone -threshold 0 -draw "rectangle 10,10 90,90" \) -channel-fx '| gray=>alpha' result.png Then replace the alpha channel of the input with the new combined alpha channel. If your input image already has transparency, then you would have to extract its alpha channel and combine it with the rectangle image. For Windows, remove the \ from the parentheses and change the end of line \ to ^.įor ImageMagick 7, replace convert with magick The above is Unix syntax for ImageMagick 6. alpha off -compose copy_opacity -composite \ The white will keep the image opaque and the black will show as transparent. So the simple answer is to create a black square in a white background and add that image as the alpha channel. You can only flood fill some region to replace a color with transparency. (His answer only works for ImageMagick 7).
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |