And save as Tiff with TiffExpectedFormat.TiffDeflateRgb (without transparency)
The alpha channel is painted by default black which seems wrong and should be white.
At least all apps I know are using white as default.
Now, the transparent area is colored black, applies to other formats
2, using TiffExpectedFormat.TiffDeflateBw will make invalid images, most colors are lost, use it with the above sample image and see the result.
Save the above image as Gif with HasTransparentColor = True and see the black border line around the edges, if set to False, the whole back color is again black!
@australian.dev.nerds
For case #2 to keep details in BW image try using the next code example, as turning Color to BW leads to inevitable color loss:
var inputPath = @"A.png";
using (var image = Image.Load(inputPath) as PngImage)
{
// use dithering to improve color transferring to BW
image.Dither(DitheringMethod.FloydSteinbergDithering, 1);
image.Save(inputPath + ".tiff", new TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffDeflateBw));
}
For case #3 Gif with transparency try using the next code example:
var inputPath = @"A.png";
using (var image = Image.Load(inputPath) as RasterImage)
{
image.Save(inputPath + ".gif", new GifOptions() { HasTransparentColor = true, BackgroundColor = Color.Transparent, });
}
As concerns case #1, we are going to explore on this topic.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): IMAGINGNET-6760
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Hello
So the key is BackgroundColor = Color.Transparent
Please use this:
.BackgroundColor = Aspose.Imaging.Color.White
On this image to see what happens: v.zip (244.8 KB)
I mean if we want to have the White as back color of transparent images?
@australian.dev.nerds , the output of image and export options above is normal, GIF does not support Alpha (transparency) as a feature but has an option to show a single color as transparent.
If you specify BackgroundColor without setting HasTransparentColor, its value is ignored and semi-transparent colors are changed to the closest ones or alpha-trimmed.
Because I convert from various formats to other formats in all combinations, should I use the above dithering in all of format conversions?
Generally you recommend to enable Dithering for transparent images or when converting to Grayscale images or for all images?
I’m confused if FloydSteinbergDithering can be used for all images, transparent, non-transparent, color, grayscale etc?
And about int bitsCount it seems that 1 and 4 and 8 supported? All can be used for all images? For color transparent or color non transparent photos what’s recommended?
Thanks
@australian.dev.nerds , dithering helps to keep details when trimming image bits-per-pixel, so it is useful in cases when you trim original image bits-per-pixel. Dithering can be used for all raster with no difference whether it has alpha or no. Dithering is especially useful before converting to 1-bit BW.
Ok so I found that for GIF I have to:
.HasTransparentColor = True
.BackgroundColor = Aspose.Imaging.Color.Transparent
But for PNG and TIFF, beside PNG Truecolor/Grayscale…WithAlpha and TiffDeflateRgba is similar BGColor thing needed to set, like:
.BackgroundColor = Aspose.Imaging.Color.Transparent ?
@australian.dev.nerds , note that behavior of GIF and PNG/TIFF is different (GIF is indexed color), but still BackgroundColor property is used to set up a background color of an image. I would recommend you to test these options for different image samples and formats!
The issues you have found earlier (filed as IMAGINGNET-6760) have been fixed in this update. This message was posted using Bugs notification tool by samer.el-khatib
And save as Gif, transparency is lost and black filled.
You already responded to set new GifOptions HasTransparentColor = True
I’m loading an image and save it in other format without any processing.
I have no idea if source image is transparent, also source | destination can be any format, so plainful, what if Aspose does it internally:
When loading an image which supports transparency, apply it to the destination file when saving, if it supports transparency.
Thanks for your kind support.
About PdfComplianceVersion, any plan to add something new?
Existing levels are ancient old, only 3 levels:
PdfA1a and PdfA1b are for accessibility, crucial but no useful in most cases for most people, so 2 are out!
The only available level is 1.5 which belongs to the louvre museum!
Do you find it useful to have Pdf 2.0 and Pdf A4?
I’m asking this because you already have them and just need to get the source code from Pdf/Words team and inject to Images! Not a from the scratch work:
@australian.dev.nerds , the ticket containing GIF processing improvements including keeping transparency is going to enter 24.09 release in case of no release process difficulties.
As for now you can try setting RasterImage.HasTransparentColor = true on converting an image to GIF.
Hope this helps!