possible spumux bug (ERR: Too many colors in base picture)

"Ryan T. Morgan" <[email protected]> Wed, 17 Oct 2018 17:36:55 -0400
Newsgroups gmane.comp.multimedia.dvdauthor.user
Message-ID <[email protected]>
Error:  "ERR: Too many colors in base picture"

This error was driving me crazy.  I was sure the PNG images I was 
providing to spumux had exactly 4 colors, no more, but I was still being 
held up with this error.

I finally found out what was wrong.  The issue: the height and/or width 
of some of my images was an odd number.

First off, I had no clue that subtitle images had to have even-numbered 
dimensions, so if this is common knowledge and I'm just an idiot, then 
please disregard, it was my fault.

However, if images with odd dimensions is permissible to spumux, then 
there might be an issue.  In subgen-image.c, in the createimage() 
function.  This function basically adds a row and/or column of 
transparent pixels to the image if necessary to create an image with 
even-numbered height and width.  This seems harmless enough, but in my 
images, I did not have any fully transparent pixels (I was using colors 
with an alpha channel to get transparency).  So this means that a fully 
transparent color was added to the palette that did not exist in the 
source image, and pushed me over the 4-color limit.

The initial workaround is simple: make sure all your images have 
even-numbered dimensions, and no unexpected pixels/colors will be added 
to the palette.  But in my case, this was not intuitive in the least.


I know there's been very little traffic on this list over the last few 
years, so I don't know how many people actually care.  Just thought I'd 
try to give back a little bit!

Thanks!

-- 
Ryan Morgan
[email protected]