Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Is it possible to change the deck color palette using an image?

A topic by MrrPalta created 20 days ago Views: 116 Replies: 2
Viewing posts 1 to 2

I’m getting tired of having to manually add the HEX values for each image to ensure they display correctly when added to the deck. I’m wondering if Decker has a feature that can read color palettes from a .gif file, so that they can be added to my project automatically and speed up the process

ya me estoy cansando de estar agregando individualmente los valores HEX de una imagen para que esta se muestre bien al agregarlo en el deck y quisiera ver si decker tiene una funcion de poder leer las paletas de colores de un archivo .gif para así agregarlo automáticamente a mi proyecto y el proceso sea más rapido

(+2)

Well, it's not a built-in feature (as far as I know) but it should be possible to create a script which imports an image and does other stuff with it at the same time. 

I don't have much direct advice on how, since I haven't done that kind of thing, but I do know that in the Array Interface section of the Decker manual there's an example of reading/using information from an imported image. Just in case that's useful to you.

I just checked that and saw that there is indeed a way, specifically using this code that was provided as an example:

bin:read["src.gif" "array"]

gif.magic      :"char",6  # "GIF89a" magic number.
gif.size       :"u16l",2  # (width,height) in pixels.
gif.gct.present:1         # flag: is there a global colortable?
gif.gct.res    :3         # color resolution (almost always 7; 8-bits per channel).
gif.gct.sorted :1         # flag: are the colors sorted by importance? (almost always zero).
gif.gct.size   :3         # number of entries in the global colortable.
gif.background :"u8"      # index of the background color.
gif.aspect     :"u8"      # pixel aspect ratio (almost always zero).

header: bin.struct[gif]
colors: bin.struct["u8",header.gct.present*3*2^header.gct.size+1]

I might be able to figure out a workaround to use it for my needs, but I’ve noticed that this method doesn’t work if you’re using Decker from within a web browser