Importing an image with alpha from Paint Shop Pro

I’ve got an image created with paint shop pro that has some
semi-transparent pixels in it and I want to use it with my SDL application.
The first try I’ve made has been to set the background color to purple
(0xFF00FF), merge all layers and save it to PNG; then load the image with
SDL_image and set the colorkey to 0xFF00FF. This works for the pixel with
opacity 100% or 0%, but it doesnt’t with semi-transparent ones (which are
blended with the background).

(1) Is there a file format both supported by psp7 and by some SDL library
that can store a RGBA surface?
(2) Is there some SDL library that can load a psp image into SDL surfaces?
(the PSP file format specs are public, but they’'e 77 pages long…)
(3) are there any other alternatives?

I’ve thought about saving the image with two different backgrounds, i.e.
purple (0xFF00FF) and green (0x00FF00) and, by comparing the RGB pixels in
the two surfaces, revert to the original RGBA image. However, this is quite
a pain in the a** - and it’s a bad, dirty work too.

[] Guido Imperiale
[] CRV?ADER/KY
[] CVI.SCIENTIA.IMPERIVM

crusaderky at libero.it
http://crusaderky.da.ru

“Nam et ipsa scientia potestas est” (Knowledge is power)
– Sir Francis Bacon (1561-1626)
Meditationes Sacrae, de Haeresibus

“I worry about my child and the Internet all the time, even though she’s
too young to have logged on yet. Here’s what I worry about. I worry that 10
or 15 years from now, she will come to me and say ‘Daddy, where were you
when they took freedom of the press away from the Internet?’”
–Mike Godwin, Electronic Frontier Foundation

Hi,

semi-transparent pixels in it and I want to use it with my SDL application.
The first try I’ve made has been to set the background color to purple
(0xFF00FF), merge all layers and save it to PNG; then load the image with
SDL_image and set the colorkey to 0xFF00FF. This works for the pixel with

I would think you simply have to: *) save the pic as a PNG (which supports
alpha-transparency) and *) use alpha in SDL instead of colorkey.
Colorkey gives you either 100% opaque or transparent, alpha gives you a
smooth transparency range, and both PNG and SDL support it.

(1) Is there a file format both supported by psp7 and by some SDL library
that can store a RGBA surface?

yes, PNG.

(2) Is there some SDL library that can load a psp image into SDL surfaces?

use IMG_Load() from the SDL-image library to load a PNG.

Cheers,
Reinhard.

semi-transparent pixels in it and I want to use it with my SDL application.
The first try I’ve made has been to set the background color to purple
(0xFF00FF), merge all layers and save it to PNG; then load the image with
SDL_image and set the colorkey to 0xFF00FF. This works for the pixel with

I would think you simply have to: *) save the pic as a PNG (which supports
alpha-transparency) and *) use alpha in SDL instead of colorkey.
Colorkey gives you either 100% opaque or transparent, alpha gives you a
smooth transparency range, and both PNG and SDL support it.

PNG supports alpha, but apparently Paint Shop Pro 7.01 does not support
PNG… :frowning:
That is, I save a psp image with no background and some semi-transparent
areas to PNG, choosing [Options]–>[Run Optimizer].
Then I select true color, [x]Alpha Channel Transparency and [x]Existing
Image or Layer Transparency and finally save it.
When I open the PNG, the picture has lost its alpha and has an opaque
black background.