Resizing images keeping aspect-ratio? - croppie

I am using the last version of Jquery Croppie v2.6.2. Its possible to define Jquery croppie when resizable function is available, to keep the aspect-ratio... the relation between Width/Height? something like this 2:1 .e.g if I resize my image with 500x250 this it's good! but I dont want to change with the square and generate an image 400x250... but also 400x200? or 100x50? Keeping the scale 2:1 when I resize the image using the "square"?
Now I can make this:
Is it possible to keep relation Width/Height when I resize? In other words avoid the "square" can resize the image free without keepping relation between Width/Height... Do you know is it possible by Croppie configuration? Or how Can I update the Jquery Croppie Library to allow this functionality?

set your viewport to a 2:1 ratio ie
viewport: {
width: 200,
height: 100
}
turn off the resizer... that is the little squares on the right and bottom that allow you to change the width and height separately thus changing the aspect ratio. Croppie will still allow you to zoom in on the image.
enableResize: false,

Related

How to set fixed height for graph area in Chart.js

I need to create multiple charts, where the graph area is exactly the same height (but other chart element heights can vary).
What kind of method could be used to achieve this functionality?
By default Chart.js aims to fill the canvas height when drawing elements which makes the graph area height dependent on the canvas height and other chart elements like the title height and legend height.
This problem has been discussed on Chart.js GitHub (https://github.com/chartjs/Chart.js/issues/3458), the devs seem to agree that this fuctionality should be handled by a custom plugin and not by the core library anyway.
I'm a bit lost. So far I've tried to modify the y-scale height, maxHeight, padding, margin etc. in beforeFit and afterFit -hooks, but those don't seem to do anything. I just don't seem to grasp how the height setting is handled in the source code and how to go about overriding it.

How do i increase the size of my tooltip in c++/cli?

I want to increase the size of my tooltip as i want to insert an image as background to my tooltip. I am able to apply an image to my tooltip but the problem is the size of the tooltip being small only the upper part of the image is being displayed.
I am displaying image using Graphics Draw Image function. And I want the tooltip to take original size of an image without creating a rectangle as I tried all already.
I don't want to create my own tooltip. Just increase size of existing one.
I resolved it!! Just needed to add spaces on the property Tool tip on mytooltip on that control on which tool tip is used.Here i have used tool tip on my buttons.

aspect ratio of photo in preview pane where height is constant and only width varies

I have a problem when i created PREVIEW HANDlER for a image . The problem is when i have photo on preview pane it dont resize itself maintaining the aspect ratio so i want to write a code so that the photo will resize itself maintaining the aspect ratio of the image. I also have to keep in mind that when i resize the image using my algorithim it should maintain the aspect ratio and the image should have possible maximum size in the preview pane (i mean there shouldn't be any other algorithim which could have the image preview of bigger size then the image obtained by our algorithim with maintained aspect ratio as well).
We have to keep in mind that height of the preview pane is constant factor so we have to deal with the changing width only(I mean according to the changing width we have to maintain the aspect ratio for both height and width of the image).
Any help is developing algorthim is appreciated.
I'll clearly define the two ratios first.
ImageRatio = WidthOfImage / HeightOfImage and
WindowRatio = WidthOfPreviewPane / HeightOfPreviewPane.
Second, you may try your windows explorer again. When the WindowRatio is smaller than the ImageRatio and you drag the pane vertically, the height of the preview pane will also change.
Finally, you may get ActualWidthOfImage and ActualHeightOfImage as below:
if (WindowRatio > ImageRatio)
{
ActualHeightOfImage = HeightOfPreviewPane;
ActualWidthOfImage = ActualHeightOfImage * ImageRatio;
}
else
{
ActualWidthOfImage = WidthOfPreviewPane;
ActualHeightOfImage = ActualWidthOfImage / ImageRatio;
}
Am I understand your problem correctly? I'd like to help you if you got further questions.

How to display different size images in CListCtrl

In my MFC program,I want to display different size images in a list!
I use CListCtrl and CImageList!
But the CImageList only can load fixed images!
Variable row heights in CListCtrl is not supported. You could take a look at this article that describes a control based on CWnd that handles drawing of variable row heights.
I would consider to use the so called "owner drawn" mode to draw these myself. I don't know about another option (there is no built-in mode)... Maybe you can also take the biggest size and fit the smaller images into the bigger frames but I think it will be the same effort and be less efficient...
I mean use the
CListCtrl::DrawItem()
method
Create a "grid," a non-symmetrical grid most likely, on a dialog or Form. Then populate it with irregular shaped images as you choose. If you need more space look into a Scrollable “whatever,” view, dialog, etc.
Irregular or non rectangular shaped bitmaps seems a good place to start.

How can you make buttons on a MSVS C++ CToolBar larger along with their images?

We have a touch screen, and the toolbar is too small to hit with my meaty fingers. Is there an easy way I can have an option to make the toolbar buttons bigger and easier to hit?
So far I've attempted a few things:
m_toolbar.SetSizes( CSize(64,64), CSize(50,50) );
m_toolbar.SetSizes( CSize(64,64), CSize(50,50) );
m_toolbar.GetToolBarCtrl().SetButtonWidth( 64, 64 );
m_toolbar.GetToolBarCtrl().SetButtonSize( CSize(64, 64) );
None of these approaches stretches the images as well. The buttons get larger, and are fully functional, but the images do not overlap the buttons the way they normally would. I would prefer to keep a single image list for the icons, and have the images stretched to fit.
At toolbar creation time, create an empty CImageList with size 64x64 (let's call it large). Load the original image list from resources (we call it small).
Iterate over each image in small and copy/resize it to large.
Then assign large to your toolbar. Somewhat cumbersome bui should work.
HTH,
As far as I know there is no way to make images resize with the size of the buttons. MFC applications use bmp and not vectorial images.
So you will have to supply a bmp images with the disired sizes.
You can use a CImageList and SetImageList to set the images but then you will have to
initialize images there with the disired size also.