Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8201771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:55:37+00:00 2026-06-07T06:55:37+00:00

I’ve had a hard time finding out how to set a colour (black in

  • 0

I’ve had a hard time finding out how to set a colour (black in my case) to be transparent in a GIF using ImageMagick. How can I do that to a set of existing GIF images?

I’ve tried this option but it doesn’t seem to do anything:

mogrify -transparent-color black -transparent black *.gif

I’ve read through this but it seems a little baffling in what actually makes a colour become transparent in a GIF: http://www.imagemagick.org/Usage/formats/#boolean_trans

For example:

Note that setting “-transparent-color” does NOT add any transparency
to a GIF image, nor does it convert the specified color to become
transparent. All the option does is specify what color should placed
in the color table for the color index that is used representing the
transparent colors in a GIF image.

If you want to change a specific (exact) color to become transparent,
then use the “-transparent” Color Replacement Operator.

but then…

Use +transparent to invert the pixels matched. that is make all
non-matching colors transparent.

The -opaque operator is exactly the same as -transparent but replaces
the matching color with the current -fill color setting, rather than
transparent. However the -transparent operator also ensures that the
image has an alpha channel enabled, as per “-alpha set”, and does not
require you to modify the -channel to enable alpha channel handling.

Note that this does not define the color as being the ‘transparency
color’ used for color-mapped image formats, such as GIF. For that use
-transparent-color

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:55:38+00:00Added an answer on June 7, 2026 at 6:55 am

    I’d like to warn you from using mogrify. mogrify does convert images by overwriting the original ones. If anything goes wrong, your images are gone.

    Rather use convert. You can always delete your original images after you are sure the conversion is ok.

    To make black pixels transparent, use this:

    convert orig.gif -transparent black transp.gif
    

    Works perfectly for me.

    My IM version: ImageMagick 6.7.8-0 2012-07-04 Q16. What’s yours?

    If it still doesn’t work for you, the ‘black’ in your GIFs may not be black after all, but only very dark gray. ImageMagick also has tools to enumerate all colors in a GIF. The following 2 commands may help you in this case:

     identify \
       -format "%f: - Uniq Colors: %k - Image transparency channel enabled: %A - Image Depth: %z %c\n" \
        *.gif
    

    and

     convert \
         *.gif \
        -format "%f :\n%c\n\n" \
         histogram:info:  
    

    Use of color black can be identified by name ‘black’, by RGB-values ‘(0, 0, 0)’ as well as by hex value ‘#000000’. So pure blacks should appear in the output of the last command as something like:

     5000: (  0,  0,  0) #000000 black
    

    Dark grays could for example be:

      100: ( 14, 14, 14,255) #0E0E0E srgba(14,14,14,1)
     2100: (  1,  1,  1,255) #010101 srgba(1,1,1,1)
    

    Once there is transparency enabled in your GIF, the last command should show a tuple of 4 values for each color, the last value representing the Alpha channel. Your formerly black would appear in the output as something like:

     5000: (  0,  0,  0,  0) #00000000 none
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.