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

Aspect ratio/stretching #25

Open
hellocatfood opened this issue Aug 8, 2019 · 1 comment
Open

Aspect ratio/stretching #25

hellocatfood opened this issue Aug 8, 2019 · 1 comment

Comments

@hellocatfood
Copy link

@hellocatfood hellocatfood commented Aug 8, 2019

I have a gif that is 640x480 that I want to play on a 1920:1080 screen whilst maintaining aspect ratio. When I play this gif using FBpyGIF it stretches to fill the whole screen. Is there any way to play the gifs full screen whilst maintaining aspect ratio?

Here's the gif I'm using

out

And what it looks like in FBpyGIF (captured from a Raspberry Pi using a HDMI capture card, hence the fuzziness)

sss

@chidea

This comment has been minimized.

Copy link
Owner

@chidea chidea commented Aug 8, 2019

This is a cumbersome function to apply because it leaves a problem exactly where to put that smaller piece of image on the entire big framebuffer.
You can use virtual window function like FBpyGIF -w 0,0,640,480 [path...] if you just want it on the left top side of the screen.
However, if you want it on the center of screen instead, it gets complicated.

x1=W/2-w/2=(W-w)/2=(1920-640)/2=640
y1=H/2-h/2=(H-h)/2=(1080-480)/2=300
x2=W/2+w/2=(W+w)/2=(1920+640)/2=1280
y2=H/2+h/2=(H+h)/2=(1080+480)/2=780

Which means you need FBpyGIF -w 640,300,1280,780 [path...].

This kind of calculations should have been implemented before but since there's more efficient rust version comming, I'm not going to try to close this issue.

Additionally, this is left unsolved because you can use its nature to have many instances of background programs to create and fill those virtual windows differently, so that it seems like they're some composited window programs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.