Page 1 of 1

How to convert alpha-blended image to grayscale?

PostPosted: Wed Oct 26, 2011 10:24 am
by hua
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

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

PostPosted: Wed Oct 26, 2011 10:53 am
by ukoenig
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:

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

PostPosted: Wed Oct 26, 2011 12:14 pm
by hua
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.

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

PostPosted: Wed Oct 26, 2011 1:06 pm
by ukoenig
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:

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

PostPosted: Wed Oct 26, 2011 11:36 pm
by ukoenig
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:

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

PostPosted: Thu Oct 27, 2011 1:42 am
by hua
Thanks Uwe :) However IcoFx is no longer a freeware. I'll give Greenfish a try.

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

PostPosted: Thu Oct 27, 2011 2:01 am
by hua
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

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

PostPosted: Thu Oct 27, 2011 1:09 pm
by Rick Lipkin
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

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

PostPosted: Fri Oct 28, 2011 1:33 am
by hua
Thanks for the input Rick :)