The problem is solved, didn't know that the opacity values are inverted in ImageMagick: 0 for fully opaque and 1.0 for fully transparent !!
So I subtracted the alpha value that belongs to QImage from 255, before scaling the result by 1/255.
mgc.alpha( scale*(255-qAlpha(pix)) );
Setting the matte ...
Search found 4 matches
- 2011-03-16T11:22:54-07:00
- Forum: Developers
- Topic: cannot produce Targa(tga) image with transparent background
- Replies: 6
- Views: 13077
- 2011-03-16T10:13:23-07:00
- Forum: Developers
- Topic: cannot produce Targa(tga) image with transparent background
- Replies: 6
- Views: 13077
Re: cannot produce Targa(tga) image with transparent backgro
It works fine for png, I got a semi-transparent image. But it fails for tga, there is no transparency, I just got a gray image.
Did you succeed for the tga case? Would you please try to obtain a semi-transparent tga image with the same code?
Did you succeed for the tga case? Would you please try to obtain a semi-transparent tga image with the same code?
- 2011-03-16T08:39:31-07:00
- Forum: Developers
- Topic: cannot produce Targa(tga) image with transparent background
- Replies: 6
- Views: 13077
Re: cannot produce Targa(tga) image with transparent backgro
hello, I have modified the above toImage function as follows,
Magick::Image* TgaFileType::toImage(QImage& qimage)
{
Magick::Image *newImage ;
double scale = 1 / 255.0;
Magick::PixelPacket *pixels;
Magick::ColorRGB mgc;
newImage = new Magick::Image(Magick::Geometry(qimage.width(), qimage ...
Magick::Image* TgaFileType::toImage(QImage& qimage)
{
Magick::Image *newImage ;
double scale = 1 / 255.0;
Magick::PixelPacket *pixels;
Magick::ColorRGB mgc;
newImage = new Magick::Image(Magick::Geometry(qimage.width(), qimage ...
- 2011-03-16T01:16:44-07:00
- Forum: Developers
- Topic: cannot produce Targa(tga) image with transparent background
- Replies: 6
- Views: 13077
cannot produce Targa(tga) image with transparent background
Hi all, I have a QImage (QT's image class) with transparent background. I use the following code to convert it to a Magick image.
Magick::Image* TgaFileType::toImage(QImage& qimage)
{
Magick::Image *newImage ;
double scale = 1 / 255.0;
Magick::PixelPacket *pixels;
Magick::ColorRGB mgc ...
Magick::Image* TgaFileType::toImage(QImage& qimage)
{
Magick::Image *newImage ;
double scale = 1 / 255.0;
Magick::PixelPacket *pixels;
Magick::ColorRGB mgc ...