skip to Main Content

I have no experience on any image processing/editing tool. And I am doing a project, which requires me to use different shapes. I could create different shapes using visio. But however not able to get rid of white background behind. I need only shape not squared white background.Tried online out of my ways but not successfull.

enter image description here

Any help will be greatly appreciated.

Thanks,
Ganesh

2

Answers


  1. Absolutely any image file has to be contained within a rectangular frame, this includes png and SVG.

    Some image file formats can have what are called alpha channel backgrounds this allows you to see through transparent areas.

    What you want to do is remove the white background to expose the alpha channel background in Photoshop (or similar tool) which can then be saved out as transparent.

    For example in Photoshop:

    enter image description here

    1. If you open this image directly and have no other layers, double click the layer that says background and OK the confirmation box. This turns your flat image into a layered image

    2. Select the magic wand tool and ensure you have a high tolerance set (3)
      with the wand selected click the white area to bring up a marquee around your selection (the white background) and hit delete to remove it.

    enter image description here

    Your image should now have a chequered background which is the transparency showing through.

    If you now go to file > save as and select png, your image should now be saved out with an alpha background.

    Please note: There are further optimisations to make if this is for web, including file formats and file size but that is beyond the scope of this question but I encourage you to read up on the Gif format and it’s restrictions, the difference between 8bit and 24bit pngs and how to use SVG.

    Login or Signup to reply.
  2. You can do it pretty simply at the command-line using ImageMagick which is free and installed on most Linux distros and is available for OSX and Windows.

    Basically, you want to make your whites transparent, so you would do

    convert shape.png -transparent white result.png
    

    If your whites are a little bit off-white, you could allow for some variation with a little fuzz as follows:

    convert shape.png -fuzz 10% -transparent white result.png
    

    enter image description here

    I added the checkerboard background just so you can see it on StackOverflow’s white background – it is not really there.

    By the way, you may like to trim to the smallest bounding rectangle while you are there:

    convert shape.png -fuzz 10% -transparent white -trim result.png
    

    enter image description here

    By the way, you can also draw your shapes with ImageMagick:

    convert -size 150x150 xc: -fill none -stroke "rgb(74,135,203)" -draw 'stroke-width 90 ellipse 0,0 80,80 30,80' arc.png
    

    enter image description here

    See Anthony Thyssen’s excellent examples here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search