Page 1 of 2

Transparent PNG Images

Posted: Wed Nov 05, 2014 2:45 pm
by calimero22
Hi All, how are you?
Excuse me if this question is repeated (but I have not found it).
If I put a PNG image with TRASPARENT property, it works fine.
But if I put another image back the principal image, I see the gray box.
What is the solution to eliminate the gray box of background?
Thank you
Giovanni Di Maria

Code: Select all

This is my code:

#include "hmg.ch"
FUNCTION Main()
   DEFINE WINDOW Form_1            ;
      AT 90,90                     ;
      WIDTH 800                    ;
      HEIGHT 600                   ;
      TITLE "Giovanni"             ;
      MAIN
   END WINDOW
   @ 0,0 IMAGE foto0    ;
      PARENT Form_1      ;
      PICTURE "background.png"  ;
      WIDTH 800          ;
      HEIGHT 600         ;
     STRETCH
   @ 20,20 IMAGE foto    ;
      PARENT Form_1      ;
      PICTURE "dog.jpg"  ;
      WIDTH 400          ;
      HEIGHT 300         ;
     STRETCH
   @ 120,150 IMAGE foto2    ;
      PARENT Form_1      ;
      PICTURE "cocacola.png"  ;
      WIDTH 100          ;
      HEIGHT 150         ;
      STRETCH  ;
      TRANSPARENT  
   ACTIVATE WINDOW Form_1
   RETURN NIL

Image

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 2:59 pm
by Javier Tovar
Tienes que usar un editor de imágenes, como Photo Shop y darle transparencia a tus imágenes en la parte blanca, checa los vídeos tutoriales en YouTube!

Saludos

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 4:03 pm
by srvet_claudio
Please upload the images CocaCola.png and BackGround.png

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 5:26 pm
by calimero22
Hi.
I have used a graphic program (photofilter) and set the alpha channel.
This program, with QT library works fine.
I send you the image files.
Thank you,
Giovanni Di Maria

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 5:30 pm
by calimero22
PS.
I don't see my topic........
Giovanni

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 6:33 pm
by EduardoLuis
Hi Calimero:

Try with this cocacola image.-
If it works and looks transparent, for better results, upload the same image in .bmp format, so i could process it better.-
cocacola.png
cocacola.png (23.93 KiB) Viewed 4044 times

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 6:51 pm
by calimero22
Here's "cocacola.bmp".
But bmp does not support trasparency.
Ciao
Giovanni

PS
I cannot send BMP. The system gives the messages "Invalid file extension".

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 7:47 pm
by EduardoLuis
Hi Calimero:

Make a Zip file with cocacola.bmp, and upload.-
By the way, BMP files admits transparency, but with the appropiate software.-
Photoshop lets you modify transparency of any image file.-
I use lots of images on my developes; all of them are .jpg, instead of png, becase .jpg provides better resolution, nearly .bmp.
Anyway all images (.PNG, .JPG. BMP) i process them with photoshop for best results with transparency.-
With regards.
Eduardo

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 8:25 pm
by calimero22
Ok. Here is the zipped file of BMP.
Thank you.
Giovanni

Re: Transparent PNG Images

Posted: Wed Nov 05, 2014 9:04 pm
by EduardoLuis
Hi calimero22:

I attach a zip file containing 3 images: 1 new bmp, 1 jpg, 1 png, all with transparency.-
Try them. Hope this will work for you.
Eduardo
cocacola2.zip
(77.57 KiB) Downloaded 203 times