Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Option to only use horizontal images #62

Open
mkotzjan opened this issue May 29, 2019 · 4 comments · Fixed by #150
Open

[Feature request] Option to only use horizontal images #62

mkotzjan opened this issue May 29, 2019 · 4 comments · Fixed by #150

Comments

@mkotzjan
Copy link

I sometimes get vertical pictures as my background which means that only a small part of the picture is shown. It would be great to have an option to use only horizontal images. Maybe its possible to get the image size before downloading, otherwise a new picture could be selected

@ifl0w
Copy link
Owner

ifl0w commented Jun 3, 2019

Thank you for the input!

@weiss-d
Copy link

weiss-d commented Sep 19, 2020

Hi everyone!
After using this extension with Reddit for three days I can confirm that this is really an issue. Every third or fourth image has portrait orientation and therefore looks very blurry when sized to 1920x1080 screen 😿

@attilakillin
Copy link

attilakillin commented Apr 25, 2021

Hi!
I'm not very familiar with how Gnome Extensions work, so I don't know how to create a visual setting for this in the GUI, but adding extra conditions to this filter expression here in the sourceAdapter.js file is pretty straightforward and seems to do the trick:

const submissions = JSON.parse(message.response_body.data).data.children.filter(child => {
	if (child.data.post_hint !== 'image') return false;
	if (require_sfw) return child.data.over_18 === false;
	if (child.data.preview.images[0].source.width < 1920) return false;
	if (child.data.preview.images[0].source.height < 1080) return false;
	if (child.data.preview.images[0].source.height >= child.data.preview.images[0].source.width) return false;
	return true;
});

The child.data.preview.images[0].source object has a width and height variable, you can use them to specify arbitrary constraints.

Perhaps the best way to implement this would be to allow the user to specify constraints themselves? E.g. width > 1920, width > 2 * height. Or if it's too complicated to parse, maybe three options, a minimum width, a minimum height, and a range of allowed aspect ratios?

Edit: Hmm it doesn't seem to work after a day of usage. I'm probably missing something...

@ifl0w
Copy link
Owner

ifl0w commented Jun 1, 2021

@attilakillin Thanks for the research and sorry for the late response! Unfortunately, the most time-consuming part for me is to fiddle around with the UI as well. Also, I'd guess that you should not use the "preview" image in the response. I'd guess it is a smaller version than the actual image for displaying in the browser?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants