PyQt5: Scaling QLabel to image size - pyqt5

I want to scale my label, because it acts like the frame for the picture. Like you can see in the picture, the frame is just too big. I tried adjustsize() but it didnt work. Maybe its because Im using a layout?
I would really appreciate your help.

Related

How does image sizing work?

I'm not the best at using bootstrap but trying to learn. I have a row and 3 col-md-4's I put a image in each column and they look and fit great with the thumbnail class. But without that class the images are their full size and overlap and when I scale the browser down they stay big and you have to use the scroll arrow. I thought the col-md-4 would determine the display of the image but it seems not. When not using the thumbnail class do I have to just resize my photos to the size I want them to display? Please help me understand. Thank you
Try using max-width="100%" (or the class img-responsive). See the bootstrap docs for more info.

Re-sizing visual image while maintaining image dimensions

I'm working with documents, so maintaining the the original image dimensions and subsequent dpi is important.
The aspect ratio is always maintained so the automatic fill modes and alike don't seem to have any effect.
Say I have a 300 dpi document and the user want to clear an inch border around the image. So I need an inch cropped from the image but the result needs to be the original image dimensions (2550x3300).
I have been able to achieve this effect with...
...&crop=300,300,-300,-300&margin=300,300,300,300
This works, but seems more than a little clunky. I've tried a lot of other combinations but they all seem to enlarge or reduce the image size which is undesirable in my case.
So does someone know a simpler syntax to achieve the desired result, or do I need to re-size the image then calculate and fill with a margin as I'm doing now.
Thanks
It turns out that my example requests the image in it's full size which turns out to be a special case. When I introduce a width or height into the command line things don't work very well since crop size is in respect to the original image dimensions and margin size is in respect to the result image.
Thinking about it more I abandoned the crop approach. What I really needed was a way to introduce a clipping region into the result bitmap. So I built an extension to do just that. It works well as it doesn't interfere with any of Resizer's layout calculations and the size of the returned image is whatever the height or width were specified as. Which is just what I needed. The Faces plugin has an example of introducing a clipping region.
Karlton
Cropping and re-adding 300px on each edge is best accomplished exactly the way you're doing it:
&crop=300,300,-300,-300&margin=300
What kind of improved syntax would you expect? This isn't a common operation.

how to create a bubbles game UI in android

I want to create a bubbles like game in android and I'm not sure how to draw the graphics.
Should I use canvas ? Every bubble should be a bitmap or maybe an image view ?
Another thing, I want to be able to rotate / scale the bubbles.
I've tried with bitmaps and canvas but wasn't able to rotate the bubbles.
Image view for every bubble looks like a mess to me.
Your help is appreciated.
Thanks
If you want to make a game, I would suggest using a Canvas, and put the Canvas over most, or all, of your layout. Creating anything but the most basic game using the regular UI structures would be a nightmare.
It sounds like you've gotten to the point where you can load the bubble images and draw them to the canvas, which is good. As for rotating the bubbles, use this:
Matrix rotator = new Matrix();
rotator.postRotate(90);
canvas.drawBitmap(bitmap, rotator, paint);
That was from an answer to this SO question, which was more specifically about rotating bitmaps on a Canvas.
For more information on making games in Android, this book was pretty helpful for me.
Hope that helps!

Rotating and Resizing CIImage

I have two CIImages. I'm trying to apply a CGAffineTransformation to the top image, and then pass it through along with the background image to the CIFilter for blending, but my resulting image seems to show the top image moving around (I just want it rotated on the spot).
I'm also having the same problem when scaling (the position of the top image seems to change).
What am I missing?
So after lots of digging, turns out my problem was due to the rotation point. This question/answer helped a lot.
CGContext rotation

Camera image size

I am writing a Cocoa application for mac osx. I'm trying to figure out how to determine the size of an image that will be captured by a camera? I would like to know the size of the image that will be captured so I can setup a view with an aspect ratio that won't distort the image. For example, if my view is defined to be 640x360 and my camera captures images that are 640x480, the displayed image looks short and fat. I'm also displaying some other layers over the image and I need the image size to be able to scale and position the layers properly.
I won't know the type of camera that is attached until run-time so I'd like to be able to interrogate the device and get attributes like image size. Thanks for the help...
You are altering the aspect ratio of the image when you capture in 640x360 instead of 640x480 or 320x240. You are doing something similar as a resize, using the whole image and making it a different size.
If you don't want to distort the image, but use only a portion of it you need to do a crop. Some hardware support cropping, others don't and you have to do it in software. Cropping is using only portions of the original image. In your case, you would discard the bottom 120 lines.
Example (from here):
The blue rectangle is the natural, or original image and the red is a crop of it.