How to convert alpha-blended image to grayscale?

How to convert alpha-blended image to grayscale?

Postby hua » Wed Oct 26, 2011 10:24 am

I would prefer btnbmp to display a disabled button in grayscale. What options do we have to do this? Is manually converting the image to greyscale the only option?

I tried using Irfan View to convert such images to grayscale but it always lose the alpha channel attribute. Uwe, anyway this can be done using Pixelformer? And thank you for all your tutorials and tools with images and enhancing looks :)

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1043
Joined: Fri Oct 28, 2005 2:27 am

Re: How to convert alpha-blended image to grayscale?

Postby ukoenig » Wed Oct 26, 2011 10:53 am

Hua,

with my Image-converter, it is easy to do this :
viewtopic.php?f=3&t=22178&p=118064&hilit=image+converter#p118064

A JPG :

Image

A button BMP :

Image

2 Lines from inside a Function, to convert a image to grey ( NConvert.exe must exist inside the MainDir. ) :

cScript := '-quiet -o Olga.jpg -grey 16 -overwrite GreyOlga.jpg'
WAITRUN ( "NConvert " + cScript, 0 )

Best Regards
uwe :lol:
Last edited by ukoenig on Wed Oct 26, 2011 12:30 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to convert alpha-blended image to grayscale?

Postby hua » Wed Oct 26, 2011 12:14 pm

Thanks Uwe! :)

Please also have a look at http://wiki.fivetechsoft.com/doku.php?i ... _resources . I list most of your utilities there. If there's any missing or there's a new version, please inform me so I could update it.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1043
Joined: Fri Oct 28, 2005 2:27 am

Re: How to convert alpha-blended image to grayscale?

Postby ukoenig » Wed Oct 26, 2011 1:06 pm

A Source-code-version of the Image-converter :

viewtopic.php?f=3&t=22254

A debugging-tool, to test Your own Functions on Window and Dialog with different Backgrounds :
( still working on a included MDI-test )

viewtopic.php?f=3&t=22435&p=119513#p119513

I noticed, converting a colored alphablended BMP to grey, the alpha-channel is lost.
I will look for a freeware-tool, that will keep the alpha-channel.

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to convert alpha-blended image to grayscale?

Postby ukoenig » Wed Oct 26, 2011 11:36 pm

Tested Tool IcoFx
Converting a PNG to Grayscale keeps the Alpha-channel.

http://icofx.ro/downloads.html

Image

Another good Freeware-Editor Greenfish works as well :

http://greenfish.xtreemhost.com/downloads.php

Image

saved as BMP => Test OK inside FWH :

Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to convert alpha-blended image to grayscale?

Postby hua » Thu Oct 27, 2011 1:42 am

Thanks Uwe :) However IcoFx is no longer a freeware. I'll give Greenfish a try.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1043
Joined: Fri Oct 28, 2005 2:27 am

Re: How to convert alpha-blended image to grayscale?

Postby hua » Thu Oct 27, 2011 2:01 am

I asked Pixelformer people about this matter and got a reply from them. I think we could use it to get grayscale with transparency too though may have to do the process twice. That is, first round export it to png and at the save dialog box checked grayscale. Then re-import the png and export it to get its bmp equivalent. Unless, unaware to me, FWH has actually started to support png natively and making the 2nd step unnecessary.

Igor of Pixelformer wrote:When exporting to a format which supports grayscale (PNG, probably), you will be offered an option to export it as grayscale. With that option, you can export RGBA as grayscale with alpha, and RGB as grayscale with binary transparency (note if you need transparency in a grayscale PNG image without an alpha channel, you must have one unused shade of gray in that image).

Regards,
Igor I. Tyrnoff


Of course this is tedious if you use a lot of images. Unless there's some way to get it to operate in batch mode
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1043
Joined: Fri Oct 28, 2005 2:27 am

Re: How to convert alpha-blended image to grayscale?

Postby Rick Lipkin » Thu Oct 27, 2011 1:09 pm

To All

Gimp is a free open source photo and image editor ( linux version as well ) , very powerful ( like photoshop ) .. easy ( with some patience ) to create layered blended images and scale to any size and one simple click desaturation to greyscale.

In this picture I took two images 48x48 .. House.png and redx.png and layered the red x into the the house.. exported the layered image to .bmp Rick.bmp ) .. then used the desaturate tool to create the greyscale ( rick1.bmp ).

At first this tool is a bit daunting but once you find the right menus .. layering, scaling, exporting and desaturation is simple.

Here is the link : http://www.gimp.org/


Image
User avatar
Rick Lipkin
 
Posts: 2631
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: How to convert alpha-blended image to grayscale?

Postby hua » Fri Oct 28, 2011 1:33 am

Thanks for the input Rick :)
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1043
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 17 guests