After many hours of beating my head against the wall about how to deal
with png cover art, possibly with transparency, I backtracked and came
up with a workaround.  The problem I was having was that I was making
the entire background semi-transparent so the linux console where cava
was running could show through.  That worked fine for cava but since the
background had an alpha channel (transparency info) I had issues with
trying to overlay a cover file (or internet radio station icon) that
also was a png with an alpha channel - the netpbm pamcomp overlay tool
has several options for dealing with transparency but I couldn't get the
combination right no matter what I tried.  I'd either get solid black in
areas that were supposed to be transparent or I'd get the transparency
areas correct but the overlay image would be subject to the background's
semi-transparency making the cover overly dim also - not what I wanted!

It occurred to me that I didn't really need the entire background to be
transparent, only the lower third or so where cava is running.  So
that's how I'm dealing with it in the below screenshots.  I start with a
full screen background, cut the top two thirds off and dim it, overlay
the cover art (full brightness), then put the bottom and top back
together along with a transparency mask that leaves the top portion
fully opaque and the lower third semi-transparent.  The transparency
level can be set in the config file.

For the text, I'm copying the portion of the background image starting
at the right edge of the cover and extending to the edge of the screen. 
Text is then composited over that and then the copied portion of the
background with text is displayed over the background in the same
position where it was copied from.  That allows me to change just that
area when a song changes and I can leave the background alone if it
doesn't need to be changed.

The expect script is updating the display on a song change event.  Still
have to do more work on the text portion.

The first screen below shows my plan for dealing with a cover that is a
png.  I'm going to assume that it contains transparency and use a
default background with the png scaled as required to the configured
cover art dimensions.  Basically, if I get anything other than a png,
I'll do the blurred background version, and if it's a png I'll use a
default background.

The second screen shows some sample text.  I think white will work for
everything.  Netpbm had a tool where I could sample the background image
and determine whether it was lighter or darker.  I thought it would be
cool to detect that and then use either black or white text as
necessary.  Don't think I'll bother as dimming the background makes even
white covers dark enough for white overlay text.

The rest are just to show that you get a nice variety of backgrounds and
colors as the covers change.


+-------------------------------------------------------------------+
|Filename: snapshot.jpg                                             |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=26142|
+-------------------------------------------------------------------+

------------------------------------------------------------------------
sodface's Profile: http://forums.slimdevices.com/member.php?userid=19057
View this thread: http://forums.slimdevices.com/showthread.php?t=109694

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to