Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Possible to make transparent .bmp icons transparent with an Access 2010 ribbon?

521 views
Skip to first unread message

PW

unread,
Feb 3, 2012, 12:33:50 AM2/3/12
to
Hi,

The icon pack I purchased comes with .bmp files that are coded in RGB
with magenta areas to define transparency. But they are showing up in
the ribbon as magenta borders, etc... Other formats are .ico and .png
which are not accepted in the ribbon (they are RGB with alpha
transparancy).

I tried converting the .bmp files to .jpgs but they show up with a
gray background (better than pink!).

Any ideas if this is possilbe?

I puchased them from Axialis.

Thanks,

-paulw

PW

unread,
Feb 3, 2012, 2:01:04 PM2/3/12
to
I just used Fireworks to convert a .png with alpha channel into a .bmp
and it looks okay. Going to be a tedius process but oh well.

Phil

unread,
Feb 3, 2012, 6:44:55 PM2/3/12
to
I've used ImageMagic to create transparent images to go on a form....
probably equally tedious, but I programmed something to draw basic boat and
camoe shapes.

Phil

PW

unread,
Feb 3, 2012, 10:33:36 PM2/3/12
to
On Fri, 3 Feb 2012 23:44:55 GMT, "Phil" <ph...@stantonfamily.co.uk>
wrote:
This one?: http://www.imagemagick.org/script/index.php

-paul

PW

unread,
Feb 3, 2012, 10:36:32 PM2/3/12
to
On Fri, 3 Feb 2012 23:44:55 GMT, "Phil" <ph...@stantonfamily.co.uk>
wrote:

Does it keep the transparency? I'll give it a try! Thanks.

-paulw

PW

unread,
Feb 3, 2012, 10:44:12 PM2/3/12
to
On Fri, 3 Feb 2012 23:44:55 GMT, "Phil" <ph...@stantonfamily.co.uk>
wrote:

Ick. No GUI or installer (if I have the right link:
http://imagemagick.en.softonic.com/).

Phil

unread,
Feb 4, 2012, 4:32:03 AM2/4/12
to
It's a b......r to find,and I cant find the source

My version is ImageMagick-6.6.8-Q16 though your link appears to be to a later
vesion I tried ImageMagick-6.6.9-Q16 and that didn't work

I was using it to display an image of a boat, with the name of the boat and
label with the owner's name and had a lot of overlaps, hence the need for
transparent images.

Sample of code follows to create a boat

Function CreateBoatImage()

Dim IMCmd As String
Dim ImFileOut As String
Dim sGO As String
Dim ImagePath As String, StoragePath As String, PicPath As String

ImagePath = Elookup("ExcelPath", "QCoinfoPaths")
StoragePath = Elookup("StorageFolder", "QCoinfoPaths")

' First 2 numbers are X & Y centres
' Second 2 numbers are width and length
' Third 2 numbers are how far round in degrees.
IMCmd = ImagePath
IMCmd MCmd = IMCmd & "convert -size 200x200 xc:none -stroke black
-strokewidth 1 -fill transparent " IMCmd = IMCmd & " -draw " & Chr$(34) &
"ellipse 80,30 40,20 20,90" & Chr$(34) & " " IMCmd = IMCmd & " -draw " &
Chr$(34) & "ellipse 80,43 40,-20 20,90" & Chr$(34) & " " IMCmd = IMCmd & "
-draw " & Chr$(34) & "line 30,26 80,23" & Chr$(34) & " " IMCmd = IMCmd & "
-draw " & Chr$(34) & "line 30,47 80,50" & Chr$(34) & " " IMCmd = IMCmd & "
-draw " & Chr$(34) & "line 30,26 30,47" & Chr$(34) & " " IMCmd = IMCmd & "
-rotate -90 " IMCmd = IMCmd & "-background transparent -trim +repage "

ChDir hDir (StoragePath) ' Imagemagick does not understand paths

ImFileOut = "MasterBoat.Png"
If Dir(ImFileOut) > "" Then
Kill ImFileOut
End If

sGO = IMCmd & ImFileOut
If ShellWait(sGO, vbHide) = 1 Then
PicPath = StoragePath & "\" & ImFileOut
Else
MsgBox "Error ???"
End If

End Function

Phil

PW

unread,
Feb 4, 2012, 1:03:30 PM2/4/12
to
On Sat, 4 Feb 2012 09:32:03 GMT, "Phil" <ph...@stantonfamily.co.uk>
Oh boy! I never thought of using code to create images!

Check this out. I haven't tried it yet. Axialis sent me this link:
http://stackoverflow.com/questions/5062021/use-png-as-custom-ribbon-icon-in-access-2007

A few references to David Fenton :-(

And a link to Albert's Ribbon Class where he uses a .png file. I need
to restudy it as I missed it last time around.

Thanks!

-paulw

Albert D. Kallal

unread,
Feb 5, 2012, 11:22:39 PM2/5/12
to
"PW" wrote in message news:m5smi79jge8n0qs8f...@4ax.com...

>Hi,
>
>The icon pack I purchased comes with .bmp files that are coded in RGB
>with magenta areas to define transparency. But they are showing up in
>the ribbon as magenta borders, etc... Other formats are .ico and .png
>which are not accepted in the ribbon (they are RGB with alpha
>transparancy).

How are you loading the icons.

The samples here:
http://www.accessribbon.de/en/index.php?Downloads

Use a routine called loadpictureGDI in placer of loadpicture() (the one that
VBA had for ages).
Using this routine will load + respect transparency.

If you just use the very old VBA loadpicture() command then I as a rule find
the icons, bmp, png, gif all look rather poor.


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
Pleasenos...@msn.com

PW

unread,
Feb 6, 2012, 7:45:52 PM2/6/12
to
On Sat, 4 Feb 2012 09:32:03 GMT, "Phil" <ph...@stantonfamily.co.uk>
One of the main guys at Axialis just gave me a break on their
IconWorkshop program, which I just bought for $35. There is a batch
feature that will convert all files in a single folder in one single
operation. And he is going to add BMP 32bpp in future releases of
their icon packs.

-paulw

PW

unread,
Feb 7, 2012, 7:46:17 PM2/7/12
to
On Sun, 5 Feb 2012 21:22:39 -0700, "Albert D. Kallal"
<PleaseNOOO...@msn.com> wrote:

>"PW" wrote in message news:m5smi79jge8n0qs8f...@4ax.com...
>
>>Hi,
>>
>>The icon pack I purchased comes with .bmp files that are coded in RGB
>>with magenta areas to define transparency. But they are showing up in
>>the ribbon as magenta borders, etc... Other formats are .ico and .png
>>which are not accepted in the ribbon (they are RGB with alpha
>>transparancy).
>
>How are you loading the icons.

Like this:

<!-- <button id="btnToday" size="large" label="Today"
image="table-edit.bmp" onAction="OnOpenFormNewRec" tag="frmToday"/>
-->
More good stuff from you Albert!

>
>Use a routine called loadpictureGDI in placer of loadpicture() (the one that
>VBA had for ages).
>Using this routine will load + respect transparency.
>
>If you just use the very old VBA loadpicture() command then I as a rule find
>the icons, bmp, png, gif all look rather poor.

Good to know, but I am just using the image property. Axialis gave me
a break on the cost of their icon workshop program that will do batch
changes.

-paul

Albert D. Kallal

unread,
Feb 8, 2012, 5:00:17 AM2/8/12
to
On Feb 7, 5:46 pm, PW <emailaddyin...@ifIremember.com> wrote:
> On Sun, 5 Feb 2012 21:22:39 -0700, "Albert D. Kallal"

> >How are you loading the icons.
>
> Like this:
>
> <!--            <button id="btnToday" size="large" label="Today"
> image="table-edit.bmp" onAction="OnOpenFormNewRec" tag="frmToday"/>
> -->

> Good to know, but I am just using the image property.  Axialis gave me
> a break on the cost of their icon workshop program that will do batch
> changes.
>
> -paul

right but show your code for the image call back - you'll see it uses
loadpicture()
Albert k

PW

unread,
Feb 8, 2012, 12:31:16 PM2/8/12
to
Yep. Sorry about that! Where do I get loadpictureGDI from?

-paulw

PW

unread,
Feb 8, 2012, 12:41:50 PM2/8/12
to
I found it in the sample iconinribbon.zip on the page you gave me a
link to, but I am having trouble getting it to work.

Albert D. Kallal

unread,
Feb 8, 2012, 9:04:16 PM2/8/12
to
"PW" wrote in message news:btc5j79uces5aj0du...@4ax.com...


>I found it in the sample iconinribbon.zip on the page you gave me a
>link to, but I am having trouble getting it to work.

Excellent.

My code is this:

Sub CallbackLoadImage(strImage As String, _
ByRef image)

Dim strImagePath As String
' Callback loadImage


If Left(strImage, 4) = "mso." Then
strImage = Mid(strImage, 5)
image = strImage
Else
strImagePath = CurrentProject.Path & "\ribbon\" & strImage
Set image = LoadPictureGDIP(strImagePath)
'Set image = LoadPictureGDIP(strImagePath) ' old built in
End If

End Sub

So the routines were just copy + lifted from the ribbon example. That
suggests that basGDI code module is required. Since the samples work, then
the use of that LoadPictureGDIP should also work.

PW

unread,
Feb 8, 2012, 10:53:16 PM2/8/12
to
Looking good Albert, but

Where is this located? LoadPictureGDIP(strImagePath)

I don't have it here. Access no can find it.

-paulw

Albert D. Kallal

unread,
Feb 9, 2012, 2:33:24 AM2/9/12
to
"PW" wrote in message news:0og6j75g1atsoemq8...@4ax.com...

>Looking good Albert, but
>
>Where is this located? LoadPictureGDIP(strImagePath)
>
>I don't have it here. Access no can find it.

From any example from the ribbon site I linked to quite sure has this code.

So from the access ribbon site, there are 31 examples on this page:

http://www.accessribbon.de/en/index.php?Downloads

Quite sure the sample code module is included in each example?

So you have to include (lift) from one of those examples the code module
called basGDI

I also have a copy of that code module in my ribbon class here:

http://www.kallal.ca/Ribbon/ribbon.htm

As noted, that load routine has support for:

bmp, gif, jpe, jpg, tif, png, wmf, emf, ico

I not ever looked at or bothering to even see what the code does.

I simply used it from the access ribbon site since anything else I used to
load icons looked like crap.

In other words, I never spent anytime looking at this issue - just used what
that web site suggested...

PW

unread,
Feb 9, 2012, 1:31:02 PM2/9/12
to
I am using converted .ico files to .bmp with transparancy preserved.
Using LoadPictureGDIP is not respecting the transparant backgrounds of
the images. The backgrounds are black instead of transparant.

I will try .png files and see if there is a difference.

-paulw

PW

unread,
Feb 9, 2012, 1:51:08 PM2/9/12
to
All right Albert. Using the "new" loadPictureGDIP function with the
.bmp files with transparent backgrounds that I converted from .ico
files makes the backgrounds black. These are how they actually appear
when I look at them on disk. Howeverif I use the original LoadPicture
function, it somehow transposes the black backgrounds and makes them
appear transparent.

Now with LoadPictureGDIP I can use other file formats like the
transparent .png icons that I have. They appear transparent like they
do on disk. But not any crisper.

So at least I will not have to go through a conversion process like I
did with the .ico->.bmp icons.

Thanks again,

-paul

Albert D. Kallal

unread,
Feb 11, 2012, 9:52:25 PM2/11/12
to
"PW" wrote in message news:q258j79glslvkbsv2...@4ax.com...


>>In other words, I never spent anytime looking at this issue - just used
>>what
>>that web site suggested...

>Howeverif I use the original LoadPicture
>function, it somehow transposes the black backgrounds and makes them
>appear transparent.

Gee, thanks for sharing the above.
I had real bad luck with Loadpicture so I just started using something that
worked and that was quite much the end of it for me.

>Now with LoadPictureGDIP I can use other file formats like the
>transparent .png icons that I have. They appear transparent like they
>do on disk. But not any crisper.
>
>So at least I will not have to go through a conversion process like I
>did with the .ico->.bmp icons.
>
>Thanks again,

Excellent, the above is also my experience. I also often use a good paint
program with some "re-sizing" options if the image in question is not the
right size
(a good paint program will have better options for re-sizing then letting
the system do it for you).

As noted, I wrote some routines and right now I really don't even read xml -
but just cut + paste from one ribbon I made and this I find faster then even
building menu bars like how we had to do in the older system.

PW

unread,
Feb 12, 2012, 12:12:47 PM2/12/12
to
Me too (faster)! I really liked making our new ribbon. Too bad I
can't do it every day. One and done (until the next release) :-(

Thanks again Albert,

-paul
0 new messages