[Pkg-pascal-devel] Change xcf2png -> ImageMagick breaks images with alpha channel

Michalis Kamburelis michalis.kambi at gmail.com
Mon Feb 15 10:55:46 GMT 2021


After some playing around:

1. I found out how to tweak these XCF files to make them properly
processed by the ImageMagick command you use. Done in
https://github.com/castle-engine/castle-engine/commit/4116d9415fd6eea95cfe23c07948daafe48d6806
.

    After applying it, the ImageMagick command you use will work OK. I
checked it by comparing with previous PNGs, and also by regenerating
CastleControlsImages.pas and compiling view3dcene with updated
buttons' images.

    Note:
    - It is a change in binary files.
    - This is done on top of CGE 7.0-alpha.1 release.

    Do you need an equivalent patch versus CGE 6.4 too (I do not
recall now whether we had some changes there to these XCF files)? If
the CGE 6.4 will be replaced soon by CGE 7.0-alpha.1 in Debian, then
possibly it doesn't matter :)

2. Background:

    I also tried to do it with GIMP Script-Fu (Scheme) in batch mode,
hoping it would avoid these tweaks to XCF files (which could be easily
forgotten in case of future modifications to these XCF files). But I
failed :) The script is there (convert-to-png.sh, convert-to-png.scm,
added in the same commit as above but unused) but it fails:

    - to apply alpha mask

    - to preserve alpha in case of already-applied alpha mask

    So I'm after using your ImageMagick commands for now.

Regards,
Michalis


czw., 11 lut 2021 o 16:39 Paul Gevers <elbrus at debian.org> napisaƂ(a):
>
> Hi Michalis,
>
> Thanks for jumping in. I'm a novice in graphics, I checked one icon
> where I first had issues with transparency, which I was able to fix.
>
> On 11-02-2021 13:46, Michalis Kamburelis wrote:
> > I checked the last change, to use ImageMagick to convert some XCF to
> > PNG within Castle Game Engine in Debian, and I don't think the command
> > works correctly.
> >
> > Testcase:
> >
> > cd src/ui/opengl/gui-images/
> > convert -layers flatten -background transparent FrameYellow.xcf
> > NewFrameYellow.png
> >
> > You can now compare NewFrameYellow.png (which will be in Debian
> > package) vs FrameYellow.png in original CGE sources (attaching). The
> > former looks like it lost alpha channel, i.e. it is all yellow. while
> > it should be only a yellow frame with transparent area in the middle.
> >
> > How can we fix it? In upstream, we use (obviously) jump GIMP to
> > convert XCF to PNG. I know that pulling GIMP as build-dependency of
> > CGE feels "heavy", but it seems like the most reliable solution.
>
> I don't care pulling in gimp if it produces better pics, so if you're
> able to provide a command line way to instruct gimp to convert the
> icons, I'll upload straight away.
>
> Paul
>



More information about the Pkg-pascal-devel mailing list