Transparent PNG Images

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

calimero22
Posts: 53
Joined: Sun Nov 04, 2012 11:00 am

Transparent PNG Images

Post 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
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Transparent PNG Images

Post 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
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Transparent PNG Images

Post by srvet_claudio »

Please upload the images CocaCola.png and BackGround.png
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
calimero22
Posts: 53
Joined: Sun Nov 04, 2012 11:00 am

Re: Transparent PNG Images

Post 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
Attachments
background.png
background.png (521.26 KiB) Viewed 4003 times
cocacola.png
cocacola.png (26.05 KiB) Viewed 4003 times
calimero22
Posts: 53
Joined: Sun Nov 04, 2012 11:00 am

Re: Transparent PNG Images

Post by calimero22 »

PS.
I don't see my topic........
Giovanni
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Transparent PNG Images

Post 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 3996 times
calimero22
Posts: 53
Joined: Sun Nov 04, 2012 11:00 am

Re: Transparent PNG Images

Post 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".
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Transparent PNG Images

Post 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
calimero22
Posts: 53
Joined: Sun Nov 04, 2012 11:00 am

Re: Transparent PNG Images

Post by calimero22 »

Ok. Here is the zipped file of BMP.
Thank you.
Giovanni
Attachments
cocacola.zip
(28.15 KiB) Downloaded 207 times
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Transparent PNG Images

Post 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 202 times
Post Reply