Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, April 1, 2008 7:02:12 AM(UTC)

gizmo  
gizmo

Groups: Registered
Posts: 2


Hello,

I'm using Leadtools raster pro v15 with .NET, and my question is quite simple:
How can I keep the png transparency by doing these actions :
_ Load a PNG file (32bits) containing transparency
_ Resize this RasterImage ( Bicubic or whatever )
_ Save the RasterImage as PNG

At the end I would like to get my resized PNG with its transparency keeped.

Thanks in advance.
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, April 2, 2008 5:26:32 AM(UTC)

Yasir Alani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


When an image that contains transparency is saved as PNG, the transparency information is saved automatically.


 


To do that use:


RasterCodecs.Load


ImageProcessing.Size


RasterCodecs.Save
 
#3 Posted : Wednesday, April 2, 2008 6:27:00 AM(UTC)

gizmo  
gizmo

Groups: Registered
Posts: 2


Thanks for your help it works fine.
Here is my code sample for people who wants to have it in details :

RasterCodecs codecs = new RasterCodecs();
RasterImage img = codecs.Load(@"D:\TestImage.png");
SizeCommand command = new SizeCommand();
command.Width = 128;
command.Height = 128;
command.Flags = RasterSizeFlags.Resample;
command.Run(img);
codecs.Save(img, @"D:\TestImageResult.png", RasterImageFormat.Png, 32);

Have fun !
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.092 seconds.