Task: Modify existing OSX cursor


Cursors in OSX are stored in PDF format. So, I used an online converter PDF -> PNG.

Next I modified resulting PNG in Windows Paint and saved it as PNG.

Problem: When looking at the resulting PNG in OSX (Preview app f.e), I see a white background. I don't see any transparency around my modified image.

I presume it is a result of the MS Paint saving the image as it appears on the screen.

Now, how do I convert all those white pixels on background to become transparent?

I tried to look online, but what I found is the converted will ask me for a specific transparency color, and I am not sure whether I should say "white" or something else.

Could someone please help?


  • 1
    $\begingroup$ I am not entirely sure if this question fits in here, as it seems like you are asking for guidance on how to use software tools, which is off-topic on this site. But I will try to answer your question anyway. $\endgroup$
    – wychmaster
    May 20, 2022 at 9:06

1 Answer 1


Like the color values, transparency is a piece of information that needs to be stored in an image. A quite common data representation is RGB with the channels red, green, and blue (often 8bit). This only contains color information. Transparency can not be represented by this format. You need to add another channel for that where you can store the transparency information. This extended format would be RGBA where A is the "alpha" channel that represents transparency. This is not a simple "yes" or "no" boolean value, since a pixel can also be partially transparent which creates a color mixture with the background. This is important to understand because the problem in your case is that the converter you used obviously dropped the alpha channel, and recreating it "correctly" is not possible in most cases.

When the program asks you to specify a transparency color, here is what is likely going to happen: The program will add the missing alpha channel and then scan every pixel of the image. If the pixel is of the specified color, it will be set the alpha value to 100% transparent and to fully opaque otherwise. So just "yes" or "no". Why is this approach problematic?

First, you might have some parts of the same color in your image that shouldn't be transparent. But the bigger problem is usually that the borders will look weird. To avoid visible staircase patterns at shape borders one usually applies some color blending on non-transparent images. For example, a black line on white background gets some grey pixels added so that the steps aren't as obvious anymore. If your image has transparent parts, you will do this blending via the alpha channel instead. The original image you used most likely did this. But when the converter dropped the alpha channel, he just stored the colors resulting from a white background.

So considering that the transparent color just sets exact color matches to transparent and everything else to opaque will give you a lot of lighter, fully opaque pixels at the border that should just be partially transparent. That would be the grey pixels from the mentioned black line. This gets more obvious and disturbing, the darker the background.

What can you do about it? You can either use an editing tool that supports direct editing of the alpha channel to correct all of this manually but the better approach would probably be to convert the original pdf again with a converter that preserves the alpha channel.

Note, that there might be some alpha reconstruction algorithms that handle things a bit smarter than I described them, but this is not as easy as one might think. If it was, there wouldn't be the need for an alpha channel at all.

  • $\begingroup$ thx for an explanation. Do you know of any such converter? $\endgroup$
    – Igor
    May 20, 2022 at 12:31
  • $\begingroup$ I seldomly use external tools and code most of the stuff myself, so I can't name a converter that does what you need. If you are willing to code some stuff yourself, I am pretty sure that there are python packages out there that do what you want. Here is a question on SO that might help with extracting unmodified images from a pdf. If you don't want to do some coding, maybe our Software Recommendations site can help you find a tool. Make sure to read their FAQ before asking ;) $\endgroup$
    – wychmaster
    May 22, 2022 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.