FloydSteinberg
FloydSteinberg
I need to reduce the number of colors in images and then dither them so there is no banding. Does GdPicture support the Floyd Steinberg dithering method? I know there is a bitonal method FxBlackNWhite that does, but I need to retain the colors. Here are my basic requirements:
1. Convert incoming color images to RGB565.
2. Remove/reduce banding caused by the color reduction.
3. Save as the images as PNG files.
I have attached an example image I have been working with that I have been attempting to convert to RGB565 and then remove the banding. Note the image prior to conversion already has some light banding. The goal is to greatly reduce or remove the banding all together.
Any help or suggestions would be greatly appreciated.
1. Convert incoming color images to RGB565.
2. Remove/reduce banding caused by the color reduction.
3. Save as the images as PNG files.
I have attached an example image I have been working with that I have been attempting to convert to RGB565 and then remove the banding. Note the image prior to conversion already has some light banding. The goal is to greatly reduce or remove the banding all together.
Any help or suggestions would be greatly appreciated.
Re: FloydSteinberg
Hi,
You can use a workaround consisting to use our GIF encoder that applies dithering on colors.
Here a snippet, let me know if you need more information:
You can use a workaround consisting to use our GIF encoder that applies dithering on colors.
Here a snippet, let me know if you need more information:
Code: Select all
Dim ms As IO.Stream = New IO.MemoryStream
Dim ImageID As Integer = Imaging1.CreateGdPictureImageFromFile("input.png")
Imaging1.SaveAsStream(ImageID, ms, DocumentFormat.DocumentFormatGIF, 0)
Imaging1.ReleaseGdPictureImage(ImageID)
ImageID = Imaging1.CreateGdPictureImageFromStream(ms)
Imaging1.SaveAsPng(ImageID, "output.png")
Imaging1.ReleaseGdPictureImage(ImageID)
ms.Dispose()
Re: FloydSteinberg
Your code snippet worked great! Thanks for the response it is much appreciated. It is good to know I will still be able to utilize the license my company purchased.
Here is the snippet in c-sharp revised for my test code:
Here is the snippet in c-sharp revised for my test code:
Code: Select all
using (System.IO.Stream ms = new System.IO.MemoryStream())
{
int intImageID = objGdP.CreateGdPictureImageFromFile(strSrcFile);
objGdP.SaveAsStream(intImageID, ms, GdPicture.DocumentFormat.DocumentFormatGIF, 0);
objGdP.ReleaseGdPictureImage(intImageID);
intImageID = objGdP.CreateGdPictureImageFromStream(ms);
objGdP.SaveAsPNG(intImageID, strDstFile);
objGdP.ReleaseGdPictureImage(intImageID);
}
Re: FloydSteinberg
The resulting image is grainy. Is there a way to get a smoother dither?
Who is online
Users browsing this forum: No registered users and 1 guest