I use widget photoframe@cinnamon.org - LMDE. I have to write exact size of width and height of photos in preferences of desklet.
But I have photos wich have different size / proportions. And desklet stretches and compresses photos. Before several updates there was just bakground color if photo didn't have size from preferences. How can I fix it like it was before?
photoframe@cinnamon.org - bad size of photos
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
photoframe@cinnamon.org - bad size of photos
Last edited by LockBot on Tue Apr 04, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: photoframe@cinnamon.org - bad size of photos
This is happening so that the desklet does not get auto resized based on each photo. In that case it would cover unwanted space on the desktop screen. So you setup dimensions and the script tries to fit the image into that "box".
However with coding changes on the desklet.js you can achieve what you wish.
After each image load you should resize the "_photoFrame" and not the image in the "_size_pic(image)" function
and not
Note that the width and height of the settings must be always set and used so the image dimensions do not get bigger from the screen. Imagine loading an image that is 4000 x 3000 pixels.
I know that it works, because I have implemented a desklet that loads only one photo (you can also create multiple instances) that keeps the image ratio and loads the box based on the image dimensions and the width - height of the settings.
However with coding changes on the desklet.js you can achieve what you wish.
After each image load you should resize the "_photoFrame" and not the image in the "_size_pic(image)" function
Code: Select all
this._photoFrame.set_size(width, height);
Code: Select all
image.set_size(width, height);
I know that it works, because I have implemented a desklet that loads only one photo (you can also create multiple instances) that keeps the image ratio and loads the box based on the image dimensions and the width - height of the settings.
Re: photoframe@cinnamon.org - bad size of photos
Thanks for your answer. I commented in /usr/share/cinnamon/desklets/photoframe@cinnamon.org/desklet.js
but unfortunately it still deforms photos.
Code: Select all
_size_pic(image) {
image.disconnect(image._notif_id);
let height, width;
let imageRatio = image.width / image.height;
let frameRatio = this.width / this.height;
if (imageRatio > frameRatio) {
width = this.width;
height = this.width / imageRatio;
} else {
height = this.height;
width = this.height * imageRatio;
}
// image.set_size(width, height);
}
Re: photoframe@cinnamon.org - bad size of photos
Comment:
and add below:
This will auto resize photoframe based on image dimensions keeping the ratio based on the Height and Width from the desklet configuration.
Code: Select all
image.set_size(width, height);
Code: Select all
this._photoFrame.set_size(width, height);
Re: photoframe@cinnamon.org - bad size of photos
I did it but it doesn't work, still deforms photos. I don't know why. But in any case thanks for your help
Re: photoframe@cinnamon.org - bad size of photos
The default dimension and ratio of the frame is landscape, so a portrait photo will be distorted.
If you change the frame to a portrait dimension/ratio then it will distort landscape pictures.
If you change the frame to a portrait dimension/ratio then it will distort landscape pictures.