Kodi Community Forum

Full Version: Image/multi image transparancy & scaling issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Ok so I'm having a few issues with image controls while developing by weather add on that has animated radars.

Scaling

I have found that when a Window is not standard size (i.e. not 1920 by 1080p), that images and multi images scale quite differently - my transparent rain slideshows that are overlayed over solid backgrounds - scale off the edges.

Is this by intention and/or solve-able? For my own purposes, I always use 1920 by 1080 but I'd like my add on to behave better in other scenarios if possible....

Transparency

I am getting some weirdness with image overlays. Basically, I have a background terrain map that then has location names, radar ranges etc, overlaid on top. The overlays are transparent pngs - some work, others don't, they transparent sections go white. Looking at the colour tables in Photoshop, they appear to be set up the same, and I can't work it out.

I think this is an XBMC bug but it might well be something in the images I can't spot it though.

ANYONE HAVE ANY IDEAS?? Help very much appreciated - it's one of the last remaining things to squish before I launch this and there's probably like three whole people eagerly awaiting the release!!

I have some image sets here:
http://code.google.com/p/bossanova808-xb...loads/list

IDR023 works
IDR193 does not - the locations overlay is rendered as white instead of see through

Skin code is this

Code:
            <!-- RADAR BACKGROUND IMAGES -->
            
         <control type="image">
                <description>background image</description>
                <posx>115</posx>
                <posy>100</posy>
                <width>512</width>
                <height>557</height>
                <texture>special://home/userdata/addon_data/weather.ozweather/radarbackgrounds/$INFO[Window.Property(Radar)]/legend.png</texture>
                <aspectratio aligny="top">keep</aspectratio>
            </control>
                        
            <control type="image">
                <description>background image</description>
                <posx>115</posx>
                <posy>100</posy>
                <width>512</width>
                <height>512</height>
                <texture>special://home/userdata/addon_data/weather.ozweather/radarbackgrounds/$INFO[Window.Property(Radar)]/background.png</texture>
                <aspectratio aligny="top">keep</aspectratio>
            </control>

            <control type="image">
                <description>locations image</description>
                <posx>115</posx>
                <posy>100</posy>
                <width>512</width>
                <height>512</height>
                <texture>special://home/userdata/addon_data/weather.ozweather/radarbackgrounds/$INFO[Window.Property(Radar)]/locations.png</texture>
                <colordiffuse>FFFFFFFF</colordiffuse>
                <aspectratio aligny="top">keep</aspectratio>
            </control>
both IDR023 and IDR193 are rendered as red on my end.

i think the problem is they're using indexed colours,
if i save them in rgb format, to show up correctly in xbmc.
How do you mean rendered red? The overlay text is red, but you should get the land/sea background picture coming through then the red text on top (with the 'white' areas of the overlay being transparent) - when it doesn't work, the white goes white, not see through. Hopefully this is what you mean.

Hmm, I did not realise pngs did non indexed colour but I guess that makes sense. I don't suppose I can do a conversion in my addonHuh It would be a one off thing as the rain overlays themselves always seems to be ok, so it would just be when initially downloading the backgrounds....

Maybe PIL could help? Ever done anything like this??
Also, if it's in RGB, how does one specify the transparent colour - is that the COLORDIFFUSE thing in the skin??
bossanova808 Wrote:How do you mean rendered red?

heh, forget what i said..
i opened the images in gimp and saved them before testing them in xbmc.
something went wrong there.

just tried it again with the original images and get the same results as you.

sorry for the confusion :-)
bossanova808 Wrote:Also, if it's in RGB, how does one specify the transparent colour - is that the COLORDIFFUSE thing in the skin??

nope, colordiffuse can be used to fade and/or colourize images.

here's the info from the wiki:
Quote:colordiffuse
This specifies the color to be used for the texture basis. It's in hex AARRGGBB format. If you define <colordiffuse>FFFF00FF</colordiffuse> (magenta), the image will be given a magenta tint when rendered. Defaults to FFFFFFFF (no tint).
Ok cool - I actually have use PIL to convert them to RGB now and it's working so I think I am all good.

Just need to work out why my plugin seems to induce a problem with screen dimming - it seems wholly unrelated but I think my XBMC won't come off dim mode now unless I reload the skin...

(I am reloading the skin if the user runs the weather script on the weather page itself by detecting the screen id #, as otherwise the new radar images don't get picked up, but if the script is called elsewhere I don't want it reloading the skin obviously...why this stops the dim-resume working, God only knows at the moment!!)
BTW while I have you - any chance you want to vote for/push this:
627 (PR)

...you will find it useful when you get back to wundergorund stuff I'd say...
bossanova808 Wrote:I am reloading the skin if the user runs the weather script on the weather page itself by detecting the screen id #, as otherwise the new radar images don't get picked up

not sure if you can use it in your script, but if you blank the window property for a second, then set it again, xbmc will pick up the new images.

i'm using this method in the artist slideshow script.

bossanova808 Wrote:BTW while I have you - any chance you want to vote for/push this:
627 (PR)

...you will find it useful when you get back to wundergorund stuff I'd say...


i'll comment on the pull request.
so a sleep(1) in the script? That would be nice for sure.

Also - I thought it was working but I am not sure it is - seems inconsistent with different image sets... more testing!!
bossanova808 Wrote:so a sleep(1) in the script? That would be nice for sure.

basically, something like this:

Code:
self.WINDOW.clearProperty("Radar")
time.sleep(1)
self.WINDOW.setProperty("Radar", value)
Ok yeah, saving as RGB in Photoshop seems to preserve transparency and solves the issue, but not converting to RGB in PIL unfortunately - that sets the transparent tone to white, so same net result grrr!
Yep that works, thanks! Actually that is really neat - I blank it, leaving only the backgrounds, then clear the looping rain image, re-download the new set, then re-instate the property - makes for a very visually neat update!

Thanks!

Also - I worked out the PIL thing - you have to save the images with an alpha channel, as RGBA not RGB....makes sense.

Cooking with gas now...
Any idea where the weather textures live so I can refer to them directly in the meantime, in case the PR doesn't go through??
ok I found them in temp/cache/weather so I've used that via special://
The scaling issue is probably because you're using 'keep' for your images and when using a non-standard aspect ratio XBMC will scale everything except for those images.
Pages: 1 2