Bug 318345 - Palettes made in Gpick or Mypaint appear half-full or empty in Krita.
Summary: Palettes made in Gpick or Mypaint appear half-full or empty in Krita.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Color Selectors (show other bugs)
Version: 2.6.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2013-04-14 15:13 UTC by wolthera
Modified: 2013-07-02 14:41 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
A pallete that is only half-read by Krita (101 bytes, application/octet-stream)
2013-04-14 15:14 UTC, wolthera
Details
The palette file before I modified it in Krita. (318 bytes, application/octet-stream)
2013-04-14 15:15 UTC, wolthera
Details
A pallete file that is considered empty by Krita. (6.48 KB, application/octet-stream)
2013-04-14 15:16 UTC, wolthera
Details
palette file modified in GIMP to test pallete swatches loading. (6.83 KB, text/plain)
2013-04-16 04:16 UTC, vanyossi
Details
Pallete file that is fixed by hand. (6.48 KB, application/octet-stream)
2013-04-17 13:52 UTC, wolthera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wolthera 2013-04-14 15:13:20 UTC
So, I like using Gpick and Mypaint to create palletes. Yet when I open my fancy palettes in Krita, only a few of the swatches show up, or none at all.

I've tried looking at the files in gedit, but I can't for the life of me figure out why Krita shows swatches on some and no swatches on others...

I'll attach some palette files in a bit.

Reproducible: Always

Steps to Reproduce:
1.Make a gpl file in Mypaint or Gpick
2. Open it in Krita
3. Observe
Comment 1 wolthera 2013-04-14 15:14:29 UTC
Created attachment 78895 [details]
A pallete that is only half-read by Krita
Comment 2 wolthera 2013-04-14 15:15:11 UTC
Created attachment 78896 [details]
The palette file before I modified it in Krita.
Comment 3 wolthera 2013-04-14 15:16:11 UTC
Created attachment 78897 [details]
A pallete file that is considered empty by Krita.
Comment 4 wolthera 2013-04-14 15:20:56 UTC
To clarify, the second palette file is half-read by Krita, the first is when I tried modifying it in Krita to see what would happen...
Comment 5 vanyossi 2013-04-16 04:16:03 UTC
Created attachment 78949 [details]
palette file modified in GIMP to test pallete swatches loading.

Hello, thank you for your report. 

I loaded your test files and as you stated, some palettes load and some doesn't, but It seems it's not entirely a Krita bug. Here is my testing

I loaded your files in GIMP but b doing that I've got all sorts of mistakes from Blue-Yellow_backup.gpl and Candy.gpl however after reporting the errors and declaring that no colors are available it loads the color swatches just fine.

After loading the Candy.gpl swatches to GIMP I saved the palette. (This saves the gpl file inside gimp preferences directory, not in the original import file)

Loading the file modified by GIMP to Krita works perfectly fine.

The files look alike but as you will notice the indentation changes a lot from one file to the other. I think that makes Gimp trow so many errors and Krita ignore the swatches. Perhaps Krita should send some errors as GIMP does?

I attach the Candy.gpl modified in GIMP
Comment 6 vanyossi 2013-04-16 04:30:00 UTC
however, there seems to be a limit on the columns in Krita. Palette's Column in Mypaint and Gimp can be set to greater than 16, like 18 or 24.

Krita columns are limited to 16 columns. I wonder if this is intended.
Comment 7 wolthera 2013-04-17 13:51:03 UTC
I don't think Krita can understand columns at all, actually. At the very least 2.6.1 doesn't.

Anyway, I figured out the problem: It's a mypaint/gpick bug actually.

Basically, Gimp and Krita consider the values of r, g and b to go from 0 to 255.
Mypaint and Gpick think they go from 1 to 256. Resulting in out-of-range colours when exporting these to Gimp and Krita.

Gimp happily throws errors at you when confronted with out-of-bound colour-ranges.
Krita however, merrily loads the colours until it finds a colour out-of-bounds, and then stops loading all together without giving the slightest hint of what is going on.

Decide for yourselves if this lack of warning can be considered a bug, in the meantime, I'm going to report a bug at the Mypaint and Gpick bugtrackers, and link them to here.
I'll attach the fixed palette, you'll notice this one doesn't start with green swatches ;)
Comment 8 wolthera 2013-04-17 13:52:12 UTC
Created attachment 78986 [details]
Pallete file that is fixed by hand.
Comment 9 Halla Rempt 2013-04-17 13:52:49 UTC
Thanks so much for the investigation! It should be pretty easy to make Krita more forgiving, marking this as a junior job.
Comment 10 Halla Rempt 2013-06-23 14:29:43 UTC
Lovely code from when I had about two years of C++ experience...

    } else if (s.startsWith("GIMP Palette")) {
        // XXX: No checks for wrong input yet!

and I didn't lie.
Comment 11 Sven Langkamp 2013-07-02 14:41:12 UTC
Git commit c0f9671483df748d9625a496ad07b29283ea02c1 by Sven Langkamp.
Committed on 02/07/2013 at 14:40.
Pushed by langkamp into branch 'master'.

Make loading of colors in colorsets more tolerant to bogus values

M  +7    -5    libs/pigment/resources/KoColorSet.cpp
M  +2    -0    libs/pigment/resources/KoColorSet.h

http://commits.kde.org/calligra/c0f9671483df748d9625a496ad07b29283ea02c1