Setting a background Image in a mode

How does the file storage/image sourcing system affect the ability to create a background image for a mode on the ETC? I’ve tried using pygame.image.load() to load a specific PNG to use as a background behind the drawn effects but I keep getting an error saying it won’t load the file. I realize this may be more of a Python question, but is there a simple way to source a specific png file in a mode whilst also using a separate folder of images in the same mode?

This mode uses a .png for the background. T - Bits H + Image | Patchstorage
If you add more than one image to the image folder, a trigger will cycle through the images.


Yes - you can have two image folders (with different names). One folder for background images, another folder for other images. You would need to duplicate the functions in setup and arrays and variables used to load the images into RAM.

1 Like

I’m making an attempt at creating a background image template so that I can take from other modes and paste reactive drawings/oscilloscopes/etcetera as an overlay. For some reason, upon subtracting what I think is the code for the Horizontal Bits (leaving just enough to set up a background image sourced from the image folder) and pasting that into a blank mode, the ETC is not reading the Mode folder at all.

(Screenshot Attached) Any idea why this may not be working? There’s a single image in my folder and my Mode folder for this is set up just like every mode is (save for a “main.pyc” file). Sorry to pester this community so much recently, I’m eager to be learning!

If you turn on the OSD and navigate to that mode, there is probably going to be an error message on the OSD. What do you see? This mode is looking for a .png file, is that what’s in the mode’s image folder?

This mode I shared the other day does a similar thing to what you were doing:

1 Like

The odd thing is: normally a mode with malfunctioning code WILL give an error message on the OSD, but the ETC was not reading the mode at all even though the computer recognizes its place in the “Modes” folder. I’d expect the numerical part of the OSD to skip a number due to the mode’s place in the folder, but it did not.

HOWEVER, your shared example mode did help! I had to remove the ability to scale the image with the knobs (I’ll fix this for myself at a later point) because the example used etc.xres or some API that the Eyesy has but the ETC does not. Running this on ETC, etc.colorknob_5 was given two arguements when it only needed one. I’ve got it working besides that though, which is all I need, and I can send my version for anyone else in need. Many Thanks!

EDIT: I can upload my version here soon, have to wait until I’ve shed myself of the “new user” status:)

Yes - you can have two image folders (with different names). One folder for background images, another folder for other images. You would need to duplicate the functions in setup and arrays and variables used to load the images into RAM.

I’ve duplicated the functions in setup and placed images in folders named “Images” and “Graphics” respectively. It’s still calling upon all the images in the mode regardless of designated sourcing folder. Would it be best to setup the background image and blit it to the screen BEFORE going into setup? The background I’m attempting to use covers up the other images, and all the images are being called upon twice, once being “blitted” to a smaller area determined by the knobs (see the “T-Basic Image” mode) and then “blitted” again to the full screen surface, on top of the smaller triggered images.

Again, endless thanks for all the help.

Maybe I misunderstand your process, but:
All images are loaded while the bootup (at least with the methods that the default etc software is using). So you won’t be able to load an image, that you have created by a screen shot just before.

It’s outside of my current knowledge, but you may be right @fanwander in that the default ETC software doesn’t allow for images to be loaded outside of the Draw part of the code. I’m looking to call upon separate designated images from separate folders loaded into the usb drive via computer (not screenshots, though there are modes for that I believe). Maybe there’s a way I can further specify the filepath in that function beyond just “… 'Images/*.png)”

Since you are using images from two folders, you should have code that loads the images from both:
Images/.png & 'Graphics/.png* right?

1 Like

Here is what I have currently, I have the functions pulling from the two folders but (again) it’s cycling through ALL images in the mode and blitting to both surface values. I’m working from the example template provided earlier.

It looks like the issue is that you are loading the images from both folders into the same array.

If you have separate arrays for each folder of images, it should get you what you are looking for (as I understand it).

The Pygame documention might be helpful: Pygame Front Page — pygame v2.0.1.dev1 documentation

1 Like

That makes perfect sense, thank you for your help as I am still learning. I’ll try at this and share anything that works!

background - blend - mode property, you can blend the background layers (images and color) of an element.