FLapique
Posts: 1
Joined: Sun Nov 03, 2019 7:38 pm

class Texture

Sun Nov 03, 2019 7:39 pm

I'm using pi3d to display 4K images ( PictureFrame.py). Is there a way of using large image ?
Allowed widths 4, 8, 16, 32, 48, 64, 72, 96, 128, 144, 192, 256, 288,
384, 512, 576, 640, 720, 768, 800, 960, 1024, 1080, 1920

User avatar
Paeryn
Posts: 2702
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: class Texture

Sun Nov 03, 2019 10:29 pm

It looks as those widths are to work around limitations of the original VC4 hardware (max width was 2048 and from the notes it looks like Pi3d had issues with widths other than those listed).

You can override Pi3d's scaling to those widths by adding automatic_resize=False to the arguments when loading the textures, this should work for the RPi4 as that has newer 3D hardware, it seems to load my test picture of 3264 x 1836 fine. The downside is that if the image is too big (over 4096 in either dimension which I think is the VC6's hardware limit for textures) then it won't downscale it for you, it just won't load the image. There might be a restriction on widths being a multiple of some value (e.g. 2 or 8), I'm not sure.

E.g. changing the 2nd line of the function tex_load() in PictureFrame.py

Code: Select all

def tex_load(fname):
  try:
    tex = pi3d.Texture(fname, blend=True, m_repeat=True, automatic_resize=False)
  except Exception as e:
    print('''Couldn't load file {}
            (probably related to Apple and or Adobe making assumptions about hardware!!): {}'''.format(fname, e))
    tex = None
  return tex
She who travels light — forgot something.

User avatar
paddyg
Posts: 2390
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: class Texture

Sun Nov 03, 2019 11:30 pm

Yes the docs FAQ probably needs some additional info about big Textures. Before the RPi4 it was possible to run two instances of pi3d using the old bcm driver and split a texture, but with the latest model and Fake KMS you can do 4K OK, so the extra parameter to Texture() sneaked in.

The original 'magic' permitted widths were arrived at on the original Raspberry Pi by resizing a texture in a loop from 1 to 2048 and pressing 'y' if the result was OK and 'n' if the GPU scrambled it! I should probably automate that process and apply it to the new setup and see if all widths work now. Maybe rescaling could be done on the basis of detected hardware and OS automatically.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Return to “Python”