# Lighten menu screenshots with GraphicsMagicMBS level

**URL:** <https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297>\
**Category:** Extras\
**Created:** [August 20, 2025, 3:32pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297 "2025-08-20T15:32:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [August 20, 2025, 3:32pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/1 "2025-08-20T15:32:57Z")

</div>

Because screenshots of menus in Tahoe are even darker than before I added an option to my little png optimiser app.

The code for the level function in GraphicsMagicMBS is quite simple:

```auto
for currentImage as Integer = 0 to PngFilesToWork.LastIndex
  
  Dim pic As Picture = Picture.Open(PngFilesToWork(currentImage))
  dim mask as Picture = pic.CopyMask
  If pic = Nil Then Continue
  
  dim image as new GMImageMBS(pic)
  image.level (0, 150.0)
  dim newPic as Picture = image.CopyPicture
  newPic.ApplyMask(mask)
  newPic.Save(PngFilesToWork(currentImage), Picture.SaveAsPNG)
next

```

But as usual Apple makes things more complicated. By using the mask of the original screenshot I avoid having the result having black edges. But the edges are not 100% okay:

 ![Screenshot 2025-08-20 at 17.30.06](https://forum.xojo.com/uploads/default/original/3X/e/a/eac8e9ecaf241f2320b1b16d6f38381d0eee7746.png)

I still get some darker pixels around the corners which looks like smudging. Any idea how to improve this?

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [August 20, 2025, 3:47pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/2 "2025-08-20T15:47:09Z")

</div>

Run your app and try this:

- Open a menu
- Press Control-Shift-4
- press space bar
- Hold Control and then click on the menu.

Without control you get this (with the shadow out side of the menu):

 ![Screenshot 2025-08-20 at 16.44.03](https://forum.xojo.com/uploads/default/original/3X/f/7/f763b92ceb5c82b1a7bef1a48314025305fb981e.png)

With Control pressed you get this (without the shadow outside of the menu):

 ![Screenshot 2025-08-20 at 16.44.56](https://forum.xojo.com/uploads/default/original/3X/9/a/9a7972ce73934817eaf914f38eb055931b8c42eb.png)

Sometimes menus change when you press Option or Command. You can press those along with Control to get those menu variants too.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [August 20, 2025, 3:52pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/3 "2025-08-20T15:52:26Z")

</div>

> [@Ian\_Kennedy](#):
>
> Sometimes menus change when you press Option or Command. You can press those along with Control to get those menu variants too.

What does this have to do with the background color of the screenshots?

 ![Screenshot 2025-08-20 at 17.51.11](https://forum.xojo.com/uploads/default/original/3X/f/0/f0af2ebaf3b7808a4a4c9fa2349dd43f7e82c523.png)

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [August 20, 2025, 3:54pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/4 "2025-08-20T15:54:36Z")

</div>

It gives you a perfectly cut out menu, which you can do anything you like with. It shouldn’t show any artefacts around the edge when processed. Run your code and try the Control version image?

It could. possibly, be caused if you are using a non-standard colour profile on the Mac. Perhaps try using “Colour LCD” and see if that makes a difference to the screenshot?

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [August 20, 2025, 4:12pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/5 "2025-08-20T16:12:52Z")

</div>

While it does give you the menu cutout correctly, I’ve found that on Sequoia it no longer includes the hover-item highlight. You must do cmd-shift-3 to get the whole screen to capture the highlight. Has that been fixed in Tahoe?

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [August 20, 2025, 4:18pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/6 "2025-08-20T16:18:43Z")

</div>

> [@Ian\_Kennedy](#):
>
> It shouldn’t show any artefacts around the edge when processed.

I always do the screenshots without shadows. And this does show the artifacts at the outer edges.

I had a look in Affinity Photo at the screenshot and the result:

The original:

 ![Screenshot 2025-08-20 at 18.12.39](https://forum.xojo.com/uploads/default/original/3X/4/4/44ad064c9fbf711006e45a6f30edf7a19d69cb51.png)

There is some lighter grey visible around the edges.

Level adjustment in Affinity Photo:

 ![Screenshot 2025-08-20 at 18.10.24](https://forum.xojo.com/uploads/default/original/3X/4/d/4d8b87f40fe477173a0edb9cbaaccb16aacaafc2.png)

This looks correct.

Level adjustment with the MBS plugin:

 ![Screenshot 2025-08-20 at 18.12.48](https://forum.xojo.com/uploads/default/original/3X/9/c/9c4728cab65f879b7ddaaaa198f23cc08d3a4c3a.png)

The outer edge now looks darker because it’s next to the white. I can play around with the mask of the original image.

@Tim Parnell: if you tell me what a “hover-item highlight” is then I can check it.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [August 20, 2025, 4:20pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/7 "2025-08-20T16:20:59Z")

</div>

Pretty sure he means the (normally) blue effect when you are pointing at a menu item.

That looks like the MBS function is doing a poor job of brightening the image. Affinity Photo didn’t suffer the same issue.

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [August 20, 2025, 4:25pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/8 "2025-08-20T16:25:24Z")

</div>

That’s probably to do with the masking stuff. I had issues like that when a small setting in Affinity Photo was pallatizing my icons during export.

Is GMImageMBS not opening the image with transparency?

Also, I stand corrected, it’s finally fixed in 15.6!

 ![Screenshot 2025-08-20 at 12.22.01](https://forum.xojo.com/uploads/default/original/3X/5/c/5c6e488a357c86af8d7bf258e8e12adfe1cf29bf.png)

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [August 21, 2025, 4:36am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/9 "2025-08-21T04:36:13Z")

</div>

> [@Ian\_Kennedy](#):
>
> MBS function is doing a poor job of brightening the image.

The problem seems to be the mask. The level function doesn’t account for the mask.

@Christian_Schmitz : is this a bug or a feature? This is the direct result of the level function:

 ![Screenshot 2025-08-21 at 06.35.18](https://forum.xojo.com/uploads/default/original/3X/2/5/250eaf07ac77c2925c7408a2ef63b8155a932b16.jpeg)

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [August 21, 2025, 5:41am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/10 "2025-08-21T05:41:47Z")

</div>

Well, I would recommend to read file directly into [GMImageMBS](https://www.monkeybreadsoftware.net/class-gmimagembs.shtml) without picture.  
You can check on [GMImageMBS](https://www.monkeybreadsoftware.net/class-gmimagembs.shtml), whether you have an alpha channel.  
And check if matte property is true. Or type has on with alpha.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [August 21, 2025, 8:00am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/11 "2025-08-21T08:00:25Z")

</div>

> [@Christian\_Schmitz](#):
>
> And check if matte property is true. Or type has on with alpha.

@Christian Schmitz: The screenshots usually have an alpha channel. But what do I do with this information? Should the level function work correctly on a picture with an alpha channel?

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [August 21, 2025, 8:43am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/12 "2025-08-21T08:43:03Z")

</div>

I am not sure. From documentation:

```auto
% LevelImage() adjusts the levels of an image by scaling the colors falling
% between specified white and black points to the full available quantum
% range. The parameters provided represent the black, mid (gamma), and white
% points. The black point specifies the darkest color in the image. Colors
% darker than the black point are set to zero. Mid point specifies a gamma
% correction to apply to the image. White point specifies the lightest color
% in the image. Colors brighter than the white point are set to the maximum
% quantum value.
%
% The format of the LevelImage method is:
%
% unsigned int LevelImage(Image *image,const char *level)
%
% A description of each parameter follows:
%
% o image: The image.
%
% o levels: Specify the levels as a string of the form "black/mid/white"
% (e.g. "10,1.0,65000) where black and white have the range of 0-MaxRGB,
% and mid has the range 0-10.

```

So it builds a color map and then applies it.  
From the code, it seems like all includes opacity.

Thinking about it, this function may not do what you think it does. Your screenshot may just have wrong gamma value in the header. Or the color space makes the difference.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [August 21, 2025, 9:05am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/13 "2025-08-21T09:05:08Z")

</div>

Gamma is what I would have used in Photoshop to address this issue.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [August 21, 2025, 9:43am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/14 "2025-08-21T09:43:13Z")

</div>

> [@Christian\_Schmitz](#):
>
> Thinking about it, this function may not do what you think it does.

Yes, I know what this function does. Gamma is not what I want:

 ![Screenshot 2025-08-21 at 11.42.42](https://forum.xojo.com/uploads/default/original/3X/f/e/fe1aefdefad6b1fec4d44a1a7baf103982c88887.jpeg)

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [August 21, 2025, 9:50am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/15 "2025-08-21T09:50:08Z")

</div>

Gamma shouldn’t be brightening the dark areas. Yours looks like it has, which isn’t what I know as Gamma. Here’s a before and after from Photoshop.

 ![Screenshot 2025-08-20 at 17.51.11](https://forum.xojo.com/uploads/default/original/3X/f/0/f0af2ebaf3b7808a4a4c9fa2349dd43f7e82c523.png) ![gammaafter](https://forum.xojo.com/uploads/default/original/3X/3/2/32a466d1a98679a92646ac0f91cddc0769963948.png)

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [August 21, 2025, 12:30pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/16 "2025-08-21T12:30:57Z")

</div>

Gamma seems to be losing the contrast of the text on the menu. I would tweak white & back points, which can be done in Preview.app with these sliders:

 ![Preview.app; Tools > Adjust Color...](https://forum.xojo.com/uploads/default/original/3X/f/3/f37515b1597ec3e305cd1c6fec3cc39f1ef44341.png)

Unfortunately, I don’t know how that translates to “what value to adjust in GraphicsMagick”. I do, however, get extremely readable results: [levels-adjusted.png](https://tim.gd/Oeurt/levels-adjusted.png)  
(“Auto Levels” will get you most of the way there!)

Circling back around to this:

> [@Tim\_Parnell](#):
>
> Is GMImageMBS not opening the image with transparency?

I think it’s important to determine why the original design is not loading the image directly into GMImageMBS. (Beatrix?) Since the problem seems to be the mask, I think if GMImageMBS has the original image to work with and no masks are applied later, the results could be usable.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [August 21, 2025, 3:38pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/17 "2025-08-21T15:38:33Z")

</div>

> [@Tim\_Parnell](#):
>
> I think it’s important to determine why the original design is not loading the image directly into GMImageMBS. (Beatrix?) Since the problem seems to be the mask, I think if GMImageMBS has the original image to work with and no masks are applied later, the results could be usable.

It’s a good idea to combine levels and gamma.

I hadn’t seen the other constructor, that is all. The different constructor doesn’t change the result. I still think that the result of the levels function should keep the mask of the original picture.

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [August 21, 2025, 3:52pm UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/18 "2025-08-21T15:52:37Z")

</div>

> [@Beatrix\_Willius](#):
>
> The different constructor doesn’t change the result. I still think that the result of the levels function should keep the mask of the original picture.

My thought was that if you are using the alpha channel within GMImageMBS, you wouldn’t need the Mask procedure at all. You would be able to get a properly transparent image from GMImageMBS.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [August 22, 2025, 7:43am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/19 "2025-08-22T07:43:30Z")

</div>

> [@Tim\_Parnell](#):
>
> My thought was that if you are using the alpha channel within GMImageMBS

Having a senior moment. How would I do that?

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [August 22, 2025, 11:58am UTC](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297/20 "2025-08-22T11:58:45Z")

</div>

@Christian_Schmitz said to avoid using Picture, so my _guess_ from the docs is the [GMImageMBS.write(f as FolderItem)](https://www.monkeybreadsoftware.net/graphicsmagick-gmimagembs-method4.shtml#w5) function.

[Next page](https://forum.xojo.com/t/lighten-menu-screenshots-with-graphicsmagicmbs-level/86297.md?page=2)
