Working RGB space

Hi, I used to set my working rgb space to Adobe RGB, but now it’s not available in all the new files (Just the sRGB), so there is a mismatch of color between my files. Any solution?
Thanks in advance.

Hi @Jose_Navio,

Welcome to the forum!

Not sure I follow exactly what you mean. If your display profile is Adobe RGB, setting a sprite to display would cover it, I imagine?

I’m using Aseprite version 1.3-beta5-x64.

For an individual sprite go to Sprite > Properties and look under advanced. You have two buttons, assign and convert color profile (they’re grayed out below because the example sprite is already in sRGB). The drop down menu has, for me, three options: None, sRGB and Display Profile.

spriteProps

If you need to edit sprites in bulk, consider writing a Lua script that uses Sprite:assignColorSpace or Sprite:convertColorSpace. These accept a file path string that leads to an .icc file, so you’d want to have Adobe RGB saved in that file format.

For the future go to Edit > Preferences > Color

check your display profile and working RGB space, and set your preferences for files with a profile and with no profile.

Best,
Jeremy

[EDIT: Woops. What I said earlier about the arguments accepted by sprite assign/convert methods is wrong. They accept a ColorSpace. The ColorSpace has a constructor which allows it to be created from a file path string. See the code below.]

Thanks Jeremy, the thing is now I only have those same three options, but before Adobe RGB also appeared. Maybe is something missing in my computer.
I’ll look into the Lua script as you say.

See you.

Hi @Jose_Navio ,

Hmm… I went back and checked with a file that already had an embedded profile, after switching my preferences for “Files with Profile” to “Use Embedded Profile.” I got a fourth option in sprite properties:

Maybe this is similar to your scenario? Hard to say without some more specifics and screen shots. You could test by opening two files with mismatched color.

Best,
Jeremy

Umm, I’m thinking, maybe is because I migrate from adobe software, importing old pngs into the aseprites files that I’ve been using since then. So…some way I embedded the icc profile without being concious about and I cannot replicate it again.

How can I insert a chosen icc profile into my files? Do a script to open with aseprite?

Thanks for your time.

Here some screen shots:

1 Like

Then I cannot export them as a png to use it toguether later cause not using the same color.

1 Like

Hi @Jose_Navo,

Thanks for the screen shots. Your game art looks good!

I don’t have a script that will exactly address the issue, but you could try something like this to see if it will solve your problem for at least one sprite. I’m pasting the script as well to minimize link rot.

local targetOptions = {"ACTIVE", "FILE", "NEW"}
local colorModes = {"RGB", "INDEXED", "GRAY"}
local paletteTypes = { "ACTIVE", "DEFAULT", "FILE", "PRESET" }
local colorSpaceTransfers = { "ASSIGN", "CONVERT" }

local defaults = {
    targetSprite = "NEW",
    width = 256,
    height = 256,
    colorMode = "RGB",
    background = Color(0, 0, 0, 0),
    paletteType = "DEFAULT",
    frames = 1,
    transfer = "CONVERT",
    pullFocus = true
}

local dlg = Dialog {
    title = "Set Color Profile"
}

dlg:combobox{
    id = "targetSprite",
    label = "Sprite:",
    option = defaults.targetSprite,
    options = targetOptions,
    onchange = function()
        local state = dlg.data.targetSprite
        local isNew = state == "NEW"
        dlg:modify {
            id = "spriteFile",
            visible = state == "FILE"
        }

        dlg:modify {
            id = "width",
            visible = isNew
        }
        dlg:modify {
            id = "height",
            visible = isNew
        }
        dlg:modify {
            id = "colorMode",
            visible = isNew
        }
        dlg:modify {
            id = "background",
            visible = isNew
        }
        dlg:modify {
            id = "frames",
            visible = isNew
        }
    end
}

dlg:newrow {
    always = false
}

dlg:file {
    id = "spriteFile",
    open = true,
    visible = defaults.targetSprite == "FILE"
}

dlg:newrow {
    always = false
}

dlg:number {
    id = "width",
    label = "Size:",
    text = string.format("%.0f", defaults.width),
    decimals = 0,
    visible = defaults.targetSprite == "NEW"
}

dlg:number {
    id = "height",
    text = string.format("%.0f", defaults.height),
    decimals = 0,
    visible = defaults.targetSprite == "NEW"
}

dlg:newrow {
    always = false
}

dlg:combobox {
    id = "colorMode",
    label = "Color Mode:",
    option = "RGB",
    options = colorModes,
    visible = defaults.targetSprite == "NEW",
    onchange = function()
        local state = dlg.data.colorMode
        dlg:modify {
            id = "background",
            visible = state ~= "INDEXED"
        }
    end
}

dlg:newrow { always = false }

dlg:color {
    id = "background",
    label = "Background:",
    color = defaults.background,
    visible = defaults.targetSprite == "NEW"
        and defaults.colorMode ~= "INDEXED"
}

dlg:newrow { always = false }

dlg:slider {
    id = "frames",
    label = "Frames:",
    min = 1,
    max = 96,
    value = defaults.frames
}

dlg:separator{}

dlg:combobox {
    id = "palType",
    label = "Palette:",
    option = defaults.paletteType,
    options = paletteTypes,
    onchange = function()
        local state = dlg.data.palType

        dlg:modify {
            id = "palFile",
            visible = state == "FILE"
        }

        dlg:modify {
            id = "palPreset",
            visible = state == "PRESET"
        }
    end
}

dlg:newrow { always = false }

dlg:file {
    id = "palFile",
    filetypes = {"gpl", "pal"},
    open = true,
    visible = defaults.paletteType == "FILE"
}

dlg:newrow { always = false }

dlg:entry {
    id = "palPreset",
    text = "",
    focus = false,
    visible = defaults.paletteType == "PRESET"
}

dlg:separator{}

dlg:file {
    id = "prf",
    label = "Profile:",
    filetypes = {"icc"},
    open = true,
    visible = true
}

dlg:newrow { always = false }

dlg:combobox {
    id = "transfer",
    label = "Transfer:",
    option = defaults.transfer,
    options = colorSpaceTransfers
}

dlg:newrow { always = false }

dlg:button {
    id = "ok",
    text = "&OK",
    focus = defaults.pullFocus,
    onclick = function()
        local args = dlg.data
        local palType = args.palType
        local colorMode = args.colorMode

        -- Set palette.
        local pal = nil
        if palType == "FILE" then
            local fp = args.palFile
            if fp and #fp > 0 then
                pal = Palette { fromFile = fp }
            end
        elseif palType == "PRESET" then
            local pr = args.palPreset
            if pr and #pr > 0 then
                pal = Palette { fromResource = pr }
            end
        elseif palType == "ACTIVE" then
            local activeSprite = app.activeSprite
            if activeSprite then
                pal = activeSprite.palettes[1]
            end
        end

        -- Search for active or file sprite.
        local sprite = nil
        local targetSprite = args.targetSprite
        if targetSprite == "FILE" then
            local pathName = args.spriteFile
            if pathName and #pathName > 0 then
                sprite = Sprite { fromFile = pathName }
                app.activeSprite = sprite
            end
        elseif targetSprite == "ACTIVE" then
            sprite = app.activeSprite
        end

        -- Last resort to establish a palette.
        if pal == nil or #pal < 1 then
            if sprite ~= nil then
                pal = sprite.palettes[1]
            else
                -- TODO: Use AseUtilities default instead?
                pal = Palette(9)
                pal:setColor(0, Color(  0,   0,   0,   0))
                pal:setColor(1, Color(  0,   0,   0, 255))
                pal:setColor(2, Color(255, 255, 255, 255))
                pal:setColor(3, Color(255,   0,   0, 255))
                pal:setColor(4, Color(255, 255,   0, 255))
                pal:setColor(5, Color(  0, 255,   0, 255))
                pal:setColor(6, Color(  0, 255, 255, 255))
                pal:setColor(7, Color(  0,   0, 255, 255))
                pal:setColor(8, Color(255,   0, 255, 255))
            end
        end

        -- Ensure that palette contains alpha in slot zero.
        local firstColor = pal:getColor(0)
        if firstColor.rgbaPixel ~= 0x0 then
            pal:resize(#pal + 1)
            for i = #pal - 1, 1, -1 do
                pal:setColor(i, pal:getColor(i - 1))
            end
            pal:setColor(0, Color(0, 0, 0, 0))
        elseif firstColor.alpha < 1 then
            -- It's possible that the first color could have
            -- non-zero channels aside from alpha.
            pal:setColor(0, Color(0, 0, 0, 0))
        end

        -- Create a new sprite.
        if targetSprite == "NEW" or sprite == nil then
            local w = args.width
            local h = args.height
            w = math.max(1, math.tointeger(0.5 + math.abs(w)))
            h = math.max(1, math.tointeger(0.5 + math.abs(h)))

            -- Create image.
            -- Do these BEFORE sprite is created
            -- and palette is set.
            local bkgClr = args.background
            local img = Image(w, h, ColorMode.RGB)
            local alpha = bkgClr.alpha
            local fillCels = alpha > 0 and colorMode ~= "INDEXED"
            if fillCels then
                local itr = img:pixels()
                local hex = bkgClr.rgbaPixel
                for elm in itr do
                    elm(hex)
                end
            end

            -- Create sprite with RGB color mode,
            -- set its palette.
            sprite = Sprite(w, h, ColorMode.RGB)
            sprite:setPalette(pal)
            app.activeSprite = sprite

            -- Create frames.
            local frameReqs = args.frames
            local layer = sprite.layers[1]
            local firstCel = layer.cels[1]
            firstCel.image = img
            for i = 0, frameReqs - 2, 1 do
                sprite:newEmptyFrame()
            end

            -- Create cels.
            if fillCels then
                local pos = Point(0, 0)
                for i = 0, frameReqs - 2, 1 do
                    sprite:newCel(layer, i + 2, img, pos)
                end
            end

            -- Set color mode.
            if colorMode == "INDEXED" then
                app.command.ChangePixelFormat {
                    format = "indexed"
                }
            elseif colorMode == "GRAY" then
                app.command.ChangePixelFormat {
                    format = "gray"
                }
            end
        elseif sprite ~= nil then
            -- Indexed mode just cannot be trusted when loading sprites.
            app.command.ChangePixelFormat {
                format = "rgb"
            }
            sprite:setPalette(pal)
        end

        local profilepath = args.prf
        local icc = nil
        if profilepath and #profilepath > 0 then
            icc = ColorSpace { fromFile = profilepath }
        else
            icc = ColorSpace()
        end

        if icc ~= nil then
            local transfer = args.transfer
            if transfer == "CONVERT" then
                sprite:convertColorSpace(icc)
            else
                sprite:assignColorSpace(icc)
            end
        end

        app.refresh()
        dlg:close()
    end
}

dlg:button {
    id = "cancel",
    text = "&CANCEL",
    onclick = function()
        dlg:close()
    end
}

dlg:show { wait = false }

I don’t have access to Adobe products, and what looked like the official Adobe color profile download link didn’t work, so I resorted to this Reddit post:

Here is a test:

Adobe1998 assigned.

Converted.

assigned2

Assigned.

converted2

Converted.

The red arrow on the bottom of the first image you posted is, to my eye, the easiest indicator for whether this works, if it works at all. And while I didn’t take a screen shot, I did get an AdobeRGB as a fourth option when I loaded the image with the .icc.

Best,
Jeremy

2 Likes

Wow! It works really well, 1000 thanks! I will keep it like gold XD.

I had never code with lao so this spare me quite a time, hope I can learn in the future.

Thank you and best wishes to you.

1 Like