This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
nhuphuong  
#1 Posted : Sunday, June 4, 2006 5:33:11 PM(UTC)
nhuphuong

Rank: Member

Groups: Guest
Joined: 6/4/2006(UTC)
Posts: 2

Hi,

I have downloaded the trial version to check some function i need before buying. Your component does great work on combining, rotating, reisize images. But how can i reduce the the capicity of a .png or .gif file (transparent image)? Please help!!

Thanks,

Thanks
Dmitry  
#2 Posted : Sunday, June 4, 2006 5:55:09 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Guest
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello,

Do you mean reduce number of colors in an image? If so, you can read more information regarding to the color reducing on our site "Basic Concepts of Color Reduction".

Edited by user Tuesday, October 28, 2008 12:04:28 AM(UTC)  | Reason: Not specified

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

nhuphuong  
#3 Posted : Monday, June 5, 2006 12:13:44 PM(UTC)
nhuphuong

Rank: Member

Groups: Guest
Joined: 6/4/2006(UTC)
Posts: 2

Hi,

When I reduce the file size by applying "Color reduction for Web", some transparent part on the image file become white. How can i deal with the problem? Please help!!

Thanks
Dmitry  
#4 Posted : Monday, June 5, 2006 9:24:54 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Guest
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello,

As palette can contain no more than 256 colors, you can specify only transparent regions in your image. By-default if you convert image to indexed format, it discards alpha channel. To avoid this problem you should blend your image with some unique color - let's name this color "transparent color". So all transparent regions are marked by this "transparent color. Then you should convert your image to indexed format and then set element of palette which corresponds to "transparent color" as transparent.

Here is small code sample which illustrates this idea:

Code:
// Color by which transparent pixels will be marked.
Aurigma.GraphicsMill.RgbColor transparentColor = Aurigma.GraphicsMill.RgbColor.Blue;

// Source bitmap with transparency.
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"d:/images/test/Transptest.png");

// Mark all transparent pixels by transparentColor.
bitmap.Channels.DiscardAlpha(transparentColor);

// Convert image to indexed.
bitmap.ColorManagement.ConvertToIndexed(8, Aurigma.GraphicsMill.ColorPaletteType.Adaptive, null, 0, Aurigma.GraphicsMill.Transforms.DitheringType.FloydSteinberg, 1.0f);

// Set element in palette which corresponds to transparentColor as transparent.
int transparentIndex = bitmap.Palette.FindNearestIndex(transparentColor);
Aurigma.GraphicsMill.RgbColor color = bitmap.Palette[transparentIndex];
bitmap.Palette[transparentIndex] = Aurigma.GraphicsMill.Color.FromArgb(0, color.R, color.G, color.B);

// Saves the result.
bitmap.Save(@"d:/temp/test.gif");

Edited by user Wednesday, December 19, 2007 4:28:19 PM(UTC)  | Reason: Not specified

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
Guest (3)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.