Post Reply 

Reduce color depth--keep transparency

Jul 14, 2013, 14:06
Post: #1
Reduce color depth--keep transparency
I have 60-something 24 bit PNG images that I've edited in Gimp, many of them include transparency. I want to batch convert them to 256 colors while keeping the transparency. Can this be done? I did try it in another editor and any attempt to keep the alpha channel transparency resulted in totally washed out colors and transparency where none should exist. Conversely, if I skipped the transparency the color depth reduction went well.
Find all posts by this user
Quote this message in a reply
Jul 14, 2013, 16:30
Post: #2
RE: Reduce color depth--keep transparency
I wish Gimp did have a dedicated reduce colours function, other than 'Posterize'.

You could try BIMP

http://registry.gimp.org/node/26259 which takes you to
http://www.alessandrofrancesconi.it/projects/bimp/ which takes you to
https://github.com/alessandrofrancesconi...lugin-bimp
If you use linux you have to compile it, otherwise for windows maybe
https://github.com/alessandrofrancesconi.../bin/win32

The steps might be, add the images
1. add a 'other gimp procedure' which would be 'gimp-image-convert-indexed' with a setting of 256.
2. add a 'other gimp procedure' which would be 'gimp-image-convert-rgb' to get back to rgb.

come to think of it you could try a straight shot at "posterize" with BIMP

Bit of a chinese scroll, fairly certain it would work. This example reduced to 4 colours.
http://i.imgur.com/K6alZra.jpg

Alternatives.
With a GUI maybe XnViewMP or command line ImageMagick.

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
Jul 14, 2013, 17:23
Post: #3
RE: Reduce color depth--keep transparency
(Jul 14, 2013 16:57)ofnuts Wrote:  
(Jul 14, 2013 16:30)rich2005 Wrote:  I wish Gimp did have a dedicated reduce colours function, other than 'Posterize'.
Image/Mode/Indexed perhaps?

That is what I normally use and that is the first 'other gimp procedure' in the BIMP batch process, as above

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
Jul 15, 2013, 00:05
Post: #4
RE: Reduce color depth--keep transparency
(Jul 14, 2013 16:10)ofnuts Wrote:  Reducing them to 256 colors will always reduce the visual quality.

Transparency along non-vertical or horizontal edges involves partially transparent pixels. These require some intermediate colors (at least three to four extra color for each transition), which are of course added to the palette at the expense of other colors.

Yes, I absolutely understand that the visual quality of a millions of colors image is superior to 256 colors. I may have misunderstood PNG transparency though. I thought that it was a grayscale mask that should be unaffected by the color depth of the main image. I can extract the alpha channel and save it as a grayscale image--maybe it's possible to do the color depth reduction and then put the alpha channel back?

Alternatively I may have to "repaint" the transparency after I've converted the images to 8 bit. The reason for all this is to obtain an alternative set of images for a flight simulator--some people have less powerful computers and / or would like to save hard disk space.
Find all posts by this user
Quote this message in a reply
Jul 15, 2013, 08:44 (This post was last modified: Jul 15, 2013 08:56 by rich2005.)
Post: #5
RE: Reduce color depth--keep transparency
If the object is to reduce file size, some stats for you.

A png file with transparency as saved with Gimp defaults.
221,488 B
Reducing the number of colours by mode -> indexed then back with mode -> rgb as the BIMP batch procedure.
171,094 B

There are png optimization applications such as here: http://psydk.org/PngOptimizer.php
That gets the original png to
193,429 B
and the 256 colour png (but the optimizer did change this back to an indexed file)
64,203 B

maybe this helps.

edit: A quick test and a straight forward mode -> indexed and a save in Gimp gets the file size down to that 65,000 B size.
Depends if your simulator supports indexed images.

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Toolbox Icons are Grey - How to Change them to Color? fishbone 1 104 Jun 25, 2018 20:57
Last Post: paynekj
  No color tim clement 1 140 May 23, 2018 15:26
Last Post: paynekj
  Why is Gimp in gray instead of color? Hard to follow tutorials jjk 1 160 May 12, 2018 06:53
Last Post: paynekj
  How do I set the color in the grid filter? beebell 2 206 Mar 18, 2018 15:21
Last Post: paynekj
  (Probably)easy transparency / background question Matthew Cole 1 222 Mar 13, 2018 18:26
Last Post: ythgilb

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS