I'm trying to adapt this image editor, so that it has a predetermined size of the canvas and that it doesn't change size according to the resolution of the image that is loaded. I wish it had a width of 300px and a height of 90px ...
and that these dimensions remain the same even if I upload an image of 1800px x 2000px.
I use this code to initialize the component:
imageEditor = new tui.ImageEditor('#tui-image-editor-container', {
includeUI: {
loadImage: {
path: 'img/wallpaper.png',
name: 'wallpaper'
},
theme: blackTheme, // or whiteTheme
menu: ['crop', 'flip', 'rotate', 'draw', 'shape', 'icon', 'text', 'mask', 'filter'],
initMenu: 'filter',
imageSize: {
oldWidth: "0",
oldHeight: "0",
newWidth: "300",
newHeight: "90"
},
uiSize: {
width: '100%',
height: '500px'
},
menuBarPosition: 'bottom'
},
cssMaxWidth: 300,
cssMaxHeight: 90,
selectionStyle: {
cornerSize: 5,
rotatingPointOffset: 70
}
});
Is there anyone who knows how this can be achieved?
After several tests I solved it in this way, definitely not the best way but for the moment it works well for me, I publish an answer, I don't know maybe it can help someone, or simply give ideas ...
I initialized the component like this:
A small change to the .css like this:
all this, however, still does not solve my problem of saving the image in the established dimensions, and therefore when saving the image, I did these operations ... I call this function to generate a new canvas and then save the image with the desired size:
hope this can help someone who has this problem.